Unix Technical Forum

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

This is a discussion on How to simply insert or update to a BLOB column using data from file within the DB2 forums, part of the Database Server Software category; --> Can someone provide me the simple syntax necessary to insert or update to a row containing a single BLOB ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 12:42 PM
shallowpool
 
Posts: n/a
Default 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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 12:44 PM
Ross Mallett
 
Posts: n/a
Default Re: How to simply insert or update to a BLOB column using data fromfile

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.









Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:00 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com