473,443 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 16157
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)...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.