DB2 Insertion failing in a batch program (using Java and DB2)

15,504

There are nested exception, and the exception that you are catching is the "top" one. You have to scan the other exceptions via the getNextException in order to detect the error. This is a normal behaviour while using JDBC.

I advise you to have a "while" in the catch part of your method, in order to found the error.

Share:
15,504
Megan
Author by

Megan

Updated on June 07, 2022

Comments

  • Megan
    Megan almost 2 years

    This is the first time I am using DB2 as Database with my Java application. I am writing a batch program and I need to insert into multiple parent - child tables.

    The issue I am facing is that the insert into the table is failing giving me the following error:

        com.ibm.db2.jcc.am.BatchUpdateException: [jcc][t4][102][10040][3.59.81] Batch failure.
    The batch was submitted, but at least one exception occurred on an individual member of the batch.
    Use getNextException() to retrieve the exceptions for specific batched elements. 
    ERRORCODE=-4229, SQLSTATE=null
                        at com.ibm.db2.jcc.am.dd.a(dd.java:404)
                        at com.ibm.db2.jcc.am.o.a(o.java:365)
                        at com.ibm.db2.jcc.am.cn.a(cn.java:4280)
                        at com.ibm.db2.jcc.am.cn.c(cn.java:4063)
                        at com.ibm.db2.jcc.t4.l.c(l.java:78)
                        at com.ibm.db2.jcc.am.cn.executeBatch(cn.java:2425)
    

    Apart from this error I am not able to find any other error in any of my log files. Kindly provide me some pointers to trace or fix this issue.