473,396 Members | 1,760 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,396 software developers and data experts.

Insert CLOB / BLOB


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
Nov 12 '05 #1
4 21662
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
Nov 12 '05 #2
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
Nov 12 '05 #3
Ian
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.

Nov 12 '05 #4
Thanks :-)

--
Message posted via http://www.dbmonster.com
Nov 12 '05 #5

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

Similar topics

2
by: Stephen Chell | last post by:
When creating a table with a CLOB column, I can (should?) specify the maximum length of the CLOB. What purpose does this serve apart from restring the length of data that can be inserted. Are...
2
by: Martin Wingelaar | last post by:
I would like to play around with BLOB and CLOB's and need the sample programs compiled by DSNTEJ71, DSNTEJ73 and DSNTEJ75. The problem is I don't have a C/C++ compiler. Could anyone send me the...
1
by: Dark | last post by:
Im trying to insert a clob into the database and I get the following error. DBD::DB2::st execute failed: SQL0804N The application program input parameters for the current request are not...
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?
0
by: yoyo | last post by:
DOes anybody have a working example of how do make this work? I've tried everything I could find, Clara patch, many non-working examples using pack, baseencode, addslashes, str_replace, bin2hex,...
46
by: dunleav1 | last post by:
I have a process that does inserts that runs 50% slower that Oracle and Mssql. Queries normally take 50% slower than normal. DB2, Oracle, Mssql all are configured on same os, same disk array...
0
by: *Davide* | last post by:
Hello, This query (PHP+Oracle) works: global $user,$pass,$sid; $db_charset = 'UTF8'; $db = OCILogon($user, $pass, $sid, $db_charset); $clob = OCINewDescriptor($db, OCI_D_LOB); $txt_clob =...
7
by: shivapadma | last post by:
I want explanation for CLOB datafield 1.I created clobtable with the query create table clobexample(id number,text CLOB); 2.I tried to insert very large text by the following query insert...
0
by: gunjangogia | last post by:
Hello everybody, Could u please tell me the when we should use blob and when to adopt clob??? I read in the previous posts about storing files in the databse. The 2 methods mentioned were...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.