vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I'm trying to insert a clob / blob from the local file system into a basic table. This can be quite easily accomplished in Oracle but I have not found any wquivalent way on how to do this in DB2. I have the following table: create table docs( doc_id integer, docs clob(), constraint pk PRIMARY KEY (doc_id)) The documents that i want to insert into clobs are located at the c drive so the path is "c:/docs" I would really appreciate any help here. BTW: I want to do this without using any external programming language. Nina -- Message posted via http://www.dbmonster.com |
| |||
| Nina via DBMonster.com wrote: > Hi, > I'm trying to insert a clob / blob from the local file system into a basic > table. This can be quite easily accomplished in Oracle but I have not found > any wquivalent way on how to do this in DB2. I have the following table: > > create table docs( > doc_id integer, > docs clob(), > constraint pk PRIMARY KEY (doc_id)) > > The documents that i want to insert into clobs are located at the c drive > so the path is "c:/docs" > > I would really appreciate any help here. > BTW: I want to do this without using any external programming language. > > Nina > Do you have the IBM Administration Tools installed? You can there with the control center make an insert by gui but the best thing you get the sql code also there. cu, indika |
| |||
| Nina via DBMonster.com wrote: > > Hi, > I'm trying to insert a clob / blob from the local file system into a basic > table. This can be quite easily accomplished in Oracle but I have not > found any wquivalent way on how to do this in DB2. I have the following > table: > > create table docs( > doc_id integer, > docs clob(), > constraint pk PRIMARY KEY (doc_id)) > > The documents that i want to insert into clobs are located at the c drive > so the path is "c:/docs" > > I would really appreciate any help here. > BTW: I want to do this without using any external programming language. Then you'll have a bit of a problem, I'd say. As for external languages, you could use a UDF as is described here: http://www-128.ibm.com/developerwork...dm-0504stolze/ -- Knut Stolze Information Integration IBM Germany / University of Jena |
| |||
| Nina via DBMonster.com wrote: > Hi, > I'm trying to insert a clob / blob from the local file system into a basic > table. This can be quite easily accomplished in Oracle but I have not found > any wquivalent way on how to do this in DB2. I have the following table: > > create table docs( > doc_id integer, > docs clob(), > constraint pk PRIMARY KEY (doc_id)) > > The documents that i want to insert into clobs are located at the c drive > so the path is "c:/docs" > > I would really appreciate any help here. > BTW: I want to do this without using any external programming language. You can use the IMPORT command, with the LOBSINFILE option. Example: "import from file.del of del modified by lobsinfile replace into table" Your file would look something like this (assuming your table has only 2 columns) 123,"abc.txt.0.1024/" (where 0 means the offset in bytes within the file to start reading the lob, and 1024 is the length of the string to read). See the docs for IMPORT and especially the file type modifiers for IMPORT that will describe this in more detail. |
| ||||
| |