Part of the problem is that the error messages come in localized, on our case in Portuguese, making the debug task a lot harder since it’s almost impossible to find decent help by searching through the error messages. The other part of the problem is that the SQL error codes sometimes are unclear.
Here’s an example of a common problem that we have in data migration projects:
com.ibm.db2.jcc.b.rg: [jcc][t4][3.50.152] Non-atomic 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. com.ibm.db2.jcc.b.pm: Error for batch element #1: The current transaction was rolled back because of error "-289".. SQLCODE=-1476, SQLSTATE=40506, DRIVER=3.50.152 com.ibm.db2.jcc.b.SqlException: [jcc][3.50.152] [...] ERRORCODE=-4225, SQLSTATE=null
Following DB2 official documentation:
- SQLCODE=-1476 means that the current transaction was rolled back because of one of the listed errors, but none of them made much sense since none of the errors identified seem to apply.
- SQLSTATE=40506 means that the current transaction was rolled back because of an SQL error, which is basically the same as the SQLCODE above.
- ERRORCODE=-4225 means an error occurred when data was sent to a server or received from a server, which is totally useless.
The real useful information is hidden in the second error message, in the ‘transaction was rolled back because of error “-289”‘ message. The key here is the -289 error.
This error means “Unable to allocate new pages in table space“, and this is the real cause for such a big fuss.
In data migration projects it’s common some of the DB2 table spaces to run out of space. But with such an error message, the error itself is kind of hidden in the middle of the stack trace, all that is shown is a loose error code…
For the sake of the developers productivity, the cause of the error should be highlighted and perfectly visible and understood in order to be quickly identified and fixed.