Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Location
    Egypt
    Posts
    61

    Unanswered: how to store image into DB2

    hi,

    i want to store images ina db2 table, can anyone give me table structre and insert/select statment for this

    thanks
    hany heggy,
    IBM certified Professional, AIX system support
    www.melodyhits.tv

  2. #2
    Join Date
    Jul 2003
    Location
    Austin, TX, USA
    Posts
    278

    Use CLOB

    Hi,

    I think you can use a clob to do it.

    The table structure can be like this

    IMAGE_MASTER(
    IMAGE_NAME VARCHAR(10),
    IMAGE_URL VARCHAR(255),
    IMAGE CLOB(2 M) NOT LOGGED NOT COMPACT)

    Please check for the datatypes in the db2 documentation for better guidance.
    HTH

    Nitin

    Ask the experienced rather than the learned

  3. #3
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Use BLOB, not CLOB, otherwise you'll get codepage conversion, which is very undesirable for bytes in an image!
    --
    Jonathan Petruk
    DB2 Database Consultant

  4. #4
    Join Date
    Feb 2004
    Location
    Copenhagen
    Posts
    220

    Exclamation Hmmm

    But the most interesting question remains!
    - how di you actually tell db2 to store a file
    in the CLOB or BLOB columns, i.e. which syntax
    would you use to insert a picture residing on the
    same server as the database??

    Cheers
    Kristian K. Hansen
    Project Supervisor
    National Board of Health

  5. #5
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Quote Originally Posted by Tank
    But the most interesting question remains!
    - how di you actually tell db2 to store a file
    in the CLOB or BLOB columns, i.e. which syntax
    would you use to insert a picture residing on the
    same server as the database??

    Cheers
    See the samples/java/jdbc/DtLob.java or samples/c/dtlob.sqc

    They actually use this exact example, inserting a picture, so it should be pretty easy from there.
    --
    Jonathan Petruk
    DB2 Database Consultant

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •