Connecting Tech Pros Worldwide Help | Site Map

DB2 Bulk Load via Java/JDBC

Newbie
 
Join Date: Sep 2008
Posts: 1
#1: Sep 22 '08
Hello forum!

I am stuck with this problem since 2 days now, and have no idea how to solve my problem.
I have a txt-file which looks like the following:
2199049812488;2201195906184;com/ibm/icu/util/ByteArrayWrapper;12;0;1942244464;
2199049813048;2199049812488;com/ibm/icu/text/RawCollationKey;12;0;1945488496;
2199049813608;2201195906184;com/ibm/icu/impl/RuleCharacterIterator;40;0;1944538224;
2199049814168;2201195906184;com/ibm/icu/text/UnicodeSet$Filter;0;0;1880149104;
2199049814728;2201195906184;com/ibm/icu/text/UnicodeMatcher;0;0;1879198832;
.
.
.


As you can see, it looks like some kind of csv-file.
I have now a line of code that bulk-inserts this txt-file quite fine, when i use it on the db2-console.
LOAD FROM 'D:/classDump.txt' OF DEL MODIFIED BY COLDEL; INSERT INTO classDump;

But now, when I try to run this command as query through JDBC, meaning as parameter of the #execute() method, I'll get an error which looks like this:
com.ibm.db2.jcc.a.rm: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=DB2 LOAD CLIENT FROM 'D:/classDump.txt' OF ;BEGIN-OF-STATEMENT;<space>, DRIVER=4.0.100

Can anyone please explain me what I am doing wrong?

Thank you and best regards,
MHR
Newbie
 
Join Date: Oct 2008
Posts: 2
#2: Oct 31 '08

re: DB2 Bulk Load via Java/JDBC


Replace COLDEL;
by COLDEL0x3B
; is interpreted as a command delimiter...
Newbie
 
Join Date: May 2008
Posts: 9
#3: Oct 31 '08

re: DB2 Bulk Load via Java/JDBC


See if the sample code snippet for LOAD operation in sqllib/samples/java/jdbc/SetIntegrity.java helps.


Thanks,
Madhavi.
docdiesel's Avatar
Moderator
 
Join Date: Aug 2007
Location: Munich
Posts: 289
#4: Nov 12 '08

re: DB2 Bulk Load via Java/JDBC


Hi,

I'm sorry to say so but LOAD won't work through JDBC. It no SQL but a CLI command which will be accepted by the DB2 command line interface only.

Regards

Doc Diesel
Reply