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 > how to store image into DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-03-04, 06:11
hanyheggy hanyheggy is offline
Registered User
 
Join Date: Jan 2004
Location: Egypt
Posts: 61
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
Reply With Quote
  #2 (permalink)  
Old 06-03-04, 06:36
nitingm nitingm is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 06-03-04, 08:34
J Petruk J Petruk is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 06-04-04, 05:38
Tank Tank is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 06-04-04, 08:38
J Petruk J Petruk is offline
Registered User
 
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
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