8
votes

I'm getting this error while executing a batch operation. Use getNextException() to retrieve the exceptions for specific batched elements.ERRORCODE=-4229, SQLSTATE=null

I'm not finding any pointer to proceed with debugging this error.

Appreciating any help!!!

3
Did you try calling getNextException() to see if it provided any additional details? onjava.com/pub/a/onjava/excerpt/javaentnut_2/index3.htmlFred Sobotka
Actually this batch operation is inside a jar file which is being called so unable to call getNextException()Java_User
Have you checked the connexion to DB2 directly from the CLP? db2 connect to xxx, and then do the same operation there. It is weird to not have a sqlstateAngocA
Atlast got the additional error message from db2. DB2 SQL Error: SQLCODE=-530, SQLSTATE=23503 Looks like it is related to PK duplicate records being inserted.Java_User

3 Answers

7
votes

Search for the error on the IBM page:

http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.java%2Fsrc%2Ftpc%2Fimjcc_rjvjcsqc.htm

-4229 Message text: text-from-getMessage Explanation: An error occurred during a batch execution.

User response: Call SQLException.getMessage to retrieve specific information about the problem.

So, it might be related to any underlying error during the execution of your batch insert/update/delete

3
votes

For those who are looking for an solution to this error.

For me this was due to

THE INSERT OR UPDATE VALUE OF FOREIGN KEY constraint-name IS INVALID. DB2 SQL Error: SQLCODE=-530, SQLSTATE=23503

1
votes

In my case, this occurred because I had an unique covering index defined on two columns and the combination of these two values was not unique when I was inserting the records.