If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to insert a DBCLOB data?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-02-04, 22:55
chunglun chunglun is offline
Registered User
 
Join Date: Apr 2004
Posts: 7
Question How to insert a DBCLOB data?

Hi,

I am inserted a record into a table that contains a DBCLOB field, the record is successfully added after executing the statement except that the DBCLOB field has inserted nothing. I have tried all the followings for the DBCLOB field:

'sample'
n'sample'
g'sample'

all of them returned nothing for the field of the new record. Could anyone please give me some idea on it?

The version of DB2 I am using is ESE UDB 8.1.5, thanks!

Chunglun
Reply With Quote
  #2 (permalink)  
Old 05-02-04, 23:58
bmujeeb bmujeeb is offline
Registered User
 
Join Date: Mar 2004
Posts: 448
I don't know what exactly you are doing, but I simply use 'sample' to insert into the field.Infact,I created a table containing dbclob(1m),insert a record into that field and select it using substr(text,1,20)

regards,

mujeeb
Reply With Quote
  #3 (permalink)  
Old 05-03-04, 05:18
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
I have not done DBCLOB, but here is how I have done CLOB

HTH

Sathyaram

1. Created the files to be loaded into clob column txt1.001 and
txt2.002 using notepad.
2. Created a DEL ASCII file import.del with contents as below

1,"txt1.001.0.25/"
2,"txt1.002.0.25/"
3,"txt1.003.0.15/"

The string in the first line "txt1.001.0.25/" is called a LOB Locator
Specifier.
An LLS is a string indicating where LOB data can be found within a file.
The format of the LLS is filename.ext.nnn.mmm/, where filename.ext is
the name of the file that contains the LOB, nnn is the offset of the LOB
within the file (measured in bytes), and mmm is the length of the LOB
(in bytes). For example, an LLS of db2exp.001.123.456/ indicates that
the LOB is located in the file db2exp.001, begins at an offset of 123
bytes into the file, and is 456 bytes long. If the indicated size in the
LLS is 0, the LOB is considered to have a length of 0. If the length is
-1, the LOB is considered to be NULL and the offset and file name are
ignored

3. Created a table test_clob
create table test_clob(a int not null primary key, b clob(10k))

I have defined the table with a primary key so that I could use the
insert_update option.

4. Imported the data into test_clob

E:\exports>db2 import from import.del of del lobs from e:\exports\
modified by lobsinfile insert_update into test_clob

SQL3109N The utility is beginning to load data from file "import.del".

SQL3110N The utility has completed processing. "3" rows were read from the input file.

SQL3221W ...Begin COMMIT WORK. Input Record Count = "3".

SQL3222W ...COMMIT of any database changes was successful.

SQL3149N "3" rows were processed from the input file. "3" rows were successfully inserted into the table. "0" rows were rejected.


Number of rows read = 3
Number of rows skipped = 0
Number of rows inserted = 3
Number of rows updated = 0
Number of rows rejected = 0
Number of rows committed = 3
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #4 (permalink)  
Old 05-03-04, 06:32
chunglun chunglun is offline
Registered User
 
Join Date: Apr 2004
Posts: 7
Thanks!

in fact, the case is originally using SQL server then transfer the database schema to DB2. It automatically alter the ntext datatype to dbclob datatype, it will insert data directly to the database, is there any other way that I can do that in stead of using text files?

Chunglun
Reply With Quote
  #5 (permalink)  
Old 05-03-04, 07:30
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
A program written, may be in C/C++, Java etc

HTH

sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #6 (permalink)  
Old 05-03-04, 22:50
chunglun chunglun is offline
Registered User
 
Join Date: Apr 2004
Posts: 7
The case is that, I am using C# to do the insertion, when I select the data, it returned an empty record of the field only...

The codeset of database and the code pages both are in utf-8, may anyone kindly give me some suggestion on it?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On