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 > Inserting records into a BLOB field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-14-05, 00:44
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
Inserting records into a BLOB field

We have a table with a BLOB field.
Now whenever I try to insert the Filename C:/x1.txt into this field it isnot getting inserted.

Please send me the query required to load this filename contents C:/x1.txt into the BLOB column.


Thanks,
Jay
Reply With Quote
  #2 (permalink)  
Old 01-14-05, 12:53
Hoggar74 Hoggar74 is offline
Registered User
 
Join Date: Jan 2005
Posts: 6
Hi

Try this


EXEC SQL BEGIN DECLARE SECTION;
SQL TYPE IS BLOB_FILE blobDocument;
EXEC SQL END DECLARE SECTION;



strcpy(blobDocument.name, szFilename); // szFilename holds the name of the file to insert
blobDocument.name_length = strlen(szFilename);
blobDocument.file_options = SQL_FILE_READ;

EXEC SQL insert into myTable
(
..., DOCUMENT, ...
)
values
(
..., :blobDocument, ...
);



I assume you use embedded SQL in C, don't you?
You should declare your environment more precise.

Ciao
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