473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to simply insert or update to a BLOB column using data from file

Can someone provide me the simple syntax necessary to insert or update
to a row containing a single BLOB column, where the BLOB data will be
obtained from a file? This is on a linux installation. The table has
2 INTs and 1 BLOB column.

So, I've scoured various docs and such, and the closest I've come up
with is some sort of animal that looks like this:

db2 load from /tmp/myblobfile of asc method L (1 780) insert
into......

Now I'm lost.

Syntax for an UPDATE command would be just as helpful.

Thanks.

Jun 4 '07 #1
1 16102
shallowpool wrote:
Can someone provide me the simple syntax necessary to insert or update
to a row containing a single BLOB column, where the BLOB data will be
obtained from a file? This is on a linux installation. The table has
2 INTs and 1 BLOB column.

So, I've scoured various docs and such, and the closest I've come up
with is some sort of animal that looks like this:

db2 load from /tmp/myblobfile of asc method L (1 780) insert
into......

Now I'm lost.

Syntax for an UPDATE command would be just as helpful.

Thanks.
LOAD CLIENT
FROM '/tmp/my_blob.dat' OF ASC
LOBS FROM /shared/
MODIFIED BY RECLEN=57 STRIPTBLANKS NULLINDCHAR=Y
LOBSINFILE
METHOD L (2 11, 13 32, 34 57)
NULL INDICATORS (1, 12, 33)
REPLACE
INTO MY_BLOB_TABLE
NONRECOVERABLE
;
A line from the data file (my_blob.dat) looks like this:

N0000000001NJohn Smith Nmy_blob0000000000.dat

The last field contains the name of the file containing the BLOB. (Here,
my_blob0000000000.dat) So the load file is nice and small. The LOB files
are in the directory /shared (which has got to end with a slash for
reasons I can't recall). This path has got to be with reference to the
server, so if your server and client are not on the same server, do what
I do and place them on a share.



Jun 7 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ole Hansen | last post by:
Hi, I have a working application inserting rows to a table using the array interface. Now I want to insert BLOBs as well but OCIStmtExecute crashes when executed with BLOBs. For BLOB types I...
0
by: Ole Hansen | last post by:
Hi, Is it at all possible to insert BLOBs using the Array Interface? Today I have an application using the array interface. It works fine but so far I haven't been using BLOBs. I insert...
3
by: Frank Natoli | last post by:
Having created a table with a longblob column, what is the insert syntax to set the value of the longblob column? The data will be read from a file.
6
by: pk | last post by:
Sorry for the piece-by-piece nature of this post, I moved it from a dormant group to this one and it was 3 separate posts in the other group. Anyway... I'm trying to bulk insert a text file of...
11
by: CSN | last post by:
Is it possible to iterate over an array in plpgsql? Something like: function insert_stuff (rel_ids int) .... foreach rel_ids as id insert into table (rel_id, val) values (id, 5);
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
11
by: Chris Fink | last post by:
I have setup an Oracle table which contains a blob field. How do I insert data into this field using C# and ADO.net?
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
6
by: Gregor =?UTF-8?B?S292YcSN?= | last post by:
Hi! I'm using JDBC to connect to DB2. I have a binary data (array of bytes) and want to save them. Is it possible to write an INSERT statement to do this: INSERT INTO TABLE (ID, BYTES)...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.