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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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. |
| ||||
| 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. |