DB2 Bulk Load via Java/JDBC

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MoleHillRocker
    New Member
    • Sep 2008
    • 1

    DB2 Bulk Load via Java/JDBC

    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;2 201195906184;co m/ibm/icu/util/ByteArrayWrappe r;12;0;19422444 64;
    2199049813048;2 199049812488;co m/ibm/icu/text/RawCollationKey ;12;0;194548849 6;
    2199049813608;2 201195906184;co m/ibm/icu/impl/RuleCharacterIt erator;40;0;194 4538224;
    2199049814168;2 201195906184;co m/ibm/icu/text/UnicodeSet$Filt er;0;0;18801491 04;
    2199049814728;2 201195906184;co m/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;<spac e>, DRIVER=4.0.100

    Can anyone please explain me what I am doing wrong?

    Thank you and best regards,
    MHR
  • earl60
    New Member
    • Oct 2008
    • 2

    #2
    Replace COLDEL;
    by COLDEL0x3B
    ; is interpreted as a command delimiter...

    Comment

    • kazam
      New Member
      • May 2008
      • 9

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


      Thanks,
      Madhavi.

      Comment

      • docdiesel
        Recognized Expert Contributor
        • Aug 2007
        • 297

        #4
        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

        Comment

        Working...