I have created a simple table called "photos", with a BLOB field. That was
easy! But how do I insert a JPG-file into that field? I have searched the
help files, but haven't been able to find anything there.
I'm using DB2 UDB 7.1 om Windows 2000.
Thanks!
Jakob
JR wrote:
--
Larry Menard
IBM Workstation Database (DB2) Performance Team
Defender of Geese and of all things Natural
> I have created a simple table called "photos", with a BLOB field. That was
> easy! But how do I insert a JPG-file into that field? I have searched the
> help files, but haven't been able to find anything there.
either by reading the jpg file into a byte-array and move this
bytearray into the database or by using a stream.
if you're using java, my faq could help (see signature).
bernd
--
the DB2 faq: http://www.harddiskcafe.de/db2faq/index.html
The easiest way to insert BLOBs is to use the IMPORT command.
db2 import from photo.txt of del lobs from d:\photos\ modified by lobsinfile
commitcount 1000 insert into sample.photo
Photo.text file:
photo1.jpg
photo2.jpg
photo3.jpg
...
photoN.jpg
Best regards, Dmitry
--
http://www.ispirer.com/chyfo.html - Tool exports data to CSV flat file,
generates CREATE TABLE, CREATE INDEX scripts for IBM DB2 and scripts for DB2
IMPORT/LOAD.
"JR" <jakob...@privat.dk> wrote in message
news:9b2ei2$8o9$1...@news.inet.tele.dk...
I have tried what you suggested, but I can't get it right.
I have written:
db2 import from d:\photos.txt of del lobs from d:\data\photos\ modified by
lobsinfile
commitcount 1000 insert into rohde.photos
and I get this reply (translated): the parametres LOB-path or LOB-file can
not be used in this manner. Reason code: "1".
The photos.txt file contains the filenames of > 1700 JPG's. The table has an
ID field which is primary key with autoincrement (empty) and it contains
other fields that I have to manually fill in later. Where do I specify into
which field the photos are to be inserted? What does "commitcount 1000"
mean?
Thanks again!
Jakob
"Dmitry" <sup...@ispirer.com> wrote in message
news:9b3mmt$7lntg$1...@ID-75577.news.dfncis.de...
When number of columns in the text file and in the table are different, try:
db2 import from d:\photos.txt of del lobs from d:\data\photos\ modified by
lobsinfile commitcount 1000 insert into rohde.photos (photo_field)
commitcount specifies when COMMIT statement is issued.
Best regards, Dmitry
--
http://www.ispirer.com - Database migration tools and services for Oracle
and IBM DB2.
"JR" <jakob...@privat.dk> wrote in message
news:9b4ejc$im2$1...@news.inet.tele.dk...