DB2: SQL Error: -803, SQLState: 23505, Unique Constraint Violation

By | July 14, 2016

Yet another thread of DB2 errors from an EJB application that connects to a DB2 instance. The reported thread of errors:

We get several DB2 error codes there that may make it more clear. Let me take you through them :

1. SQL Error: -4229, SQLState: null
Translated: “Batch failure. The batch was submitted, but at least one exception occurred on an individual member of the batch. ”

Note: This is the top error at batch level so we have to go deeper to find the cause.

2. SQL Error: -803, SQLState: 23505
Translated: “Error for batch element #1: One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by “1” constrains table “INST1.MESSAGEKEY” from having duplicate values for the index key..”

Note: This informs us that an element of the transaction batch failed. The cause is clearly indicated as a “unique constraint or unique index” violation on the table “INST1.MESSAGEKEY”.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.