Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2010

    Unanswered: insert image into db2


    I want to store an image into table in db2..

    Is there any simple way to store image into db2..
    such as upload/import directly from directory C into blob table..

    the table look like this

    CREATE TABLE photo(picture BLOB(50K))

    any help would be grateful

  2. #2
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    Save the image in a file, e.g. c:\temp\photos\myface.jpg

    Create a text file, e.g. c:\temp\import.txt with the contents:


    Issue an IMPORT command:

    db2 import from c:\temp\import.txt lobs from c:\temp\photos method p(1) insert into photo (picture)

    I'm curious how you will be looking up pictures from a table that does not have a key...

  3. #3
    Join Date
    Oct 2010
    thanks for the reply..

    actually the table is just for example..

    so if i create table like this
    CREATE TABLE photo(id int, picture BLOB(50K)) ..

    the c:\temp\import.txt with the contents will be:

    1, "myface.jpg"

    am i right?

    i just curious if i can or not import xml and lob at same time into table below..
    CREATE TABLE photo(id int, picture_info XML, picture BLOB(50K))...

Posting Permissions

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