'Insert of BLOBs'

[login to unmask email]

'Insert of BLOBs'
Hi,

I have a table which has the following structure :

Table x.

A CHAR(20) PK
B DECIMAL(05) PK
C BLOB(1M)

I have a 'MS-Word' document(abc.doc) which I want to insert into the above table(ie. into the BLOB field).
Is it possible to insert this using the command insert / import /Load etc. I am working on UDB 6.1 on NT.

Thanks in advance
Siva



=====================
DISCLAIMER:
The opinion expressed above is that of the author and should not be understood
or in-terpreted as equivalent to the opinion of Deutsche Bank AG or any of its
subsidiary companies
=====================



Bela Hamar

Re: 'Insert of BLOBs'
(in response to dsi.listsrv@DB.COM)
Hi Siva,

of course, you can insert data into the LOB columns.
How:

1. INSERT :
a. host variable of type C/BLOB(...)
this is similar to the VARCHAR [FOR BIT DATA]
(data & length (long int!) components
b. or you can use host variables of type
[VAR]CHAR [FOR BIT DATA]
since they can be automatically converted to C/BLOB

a. & b. can be used in CLP too

c. LOB data is stored in a file:
host variable of type C/BLOB-FILE
this is a structure which describes the name of the file,
the file creation options etc.
This must be filled by the program before INSERT.
Can be used only by embedded programs.

(d. you can use a LOB-locator when retrieving LOB data)

2. LOAD

a. the LOB data can be in the input file
LOAD FROM input-file OF DEL/... ...
For example: (DEL filetype)
"a1-value", "b1-value", "c1-value"
"a2-value", "b2-value", "c2-value"

b. each LOB-value is stored in a separate file:
LOAD FROM input-file OF ...
LOBS FROM dir1, dir2, ...
MODIFIED BY LOBSINFILE
...

For example: (DEL)
"a1-value", "b1-value", "file1"
"a2-value", "b2-value", "file2"

LOAD searches for the file1/2 in the dir1/2/...
directories.

3. IMPORT

a. & b. the same as by LOAD
My experience is, that you must put a backslash '\'
to the end of the path given in the LOBS FROM ... clause
in the IMPORT statement.


Under UNIX, LOAD/IMPORT worked for me only if the files/pipes were on a
local file system.
Under Win there was no problem with the network mapped drives.

I hope, these help, cheers,
Bela



----------------------------------------------------------------------------------------------------
original msg:

Hi,

I have a table which has the following structure :

Table x.

A CHAR(20) PK
B DECIMAL(05) PK
C BLOB(1M)

I have a 'MS-Word' document(abc.doc) which I want to insert into the above
table(ie. into the BLOB field).
Is it possible to insert this using the command insert / import /Load etc.
I am working on UDB 6.1 on NT.

Thanks in advance
Siva



Michael McCarthy

Re: 'Insert of BLOBs'
(in response to Bela Hamar)
Hi Siva,

The easiest way to insert and retrieve BLOB data on the ascii platforms is
through file reference variables. I have some sample C code that does just
that. If you would like the samples, email me directly, and I will send them to
you.

-Mike.





[login to unmask email] on 12/13/2000 11:43:09 PM

Please respond to DB2 Data Base Discussion List <[login to unmask email]>

To: [login to unmask email]
cc: (bcc: Michael McCarthy/DTC)
Subject: [DB2-L] 'Insert of BLOBs'




Hi,

I have a table which has the following structure :

Table x.

A CHAR(20) PK
B DECIMAL(05) PK
C BLOB(1M)

I have a 'MS-Word' document(abc.doc) which I want to insert into the above
table(ie. into the BLOB field).
Is it possible to insert this using the command insert / import /Load etc. I am
working on UDB 6.1 on NT.

Thanks in advance
Siva



=====================

DISCLAIMER:
The opinion expressed above is that of the author and should not be understood
or in-terpreted as equivalent to the opinion of Deutsche Bank AG or any of its
subsidiary companies
=====================