If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > insert image into db2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-02-10, 13:32
tempe tempe is offline
Registered User
 
Join Date: Oct 2010
Posts: 27
insert image into db2

Hello..

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
Reply With Quote
  #2 (permalink)  
Old 10-03-10, 08:42
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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:

"myface.jpg"

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...
Reply With Quote
  #3 (permalink)  
Old 10-03-10, 09:12
tempe tempe is offline
Registered User
 
Join Date: Oct 2010
Posts: 27
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))...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On