DB2 Error Code 2627 – Violation of PRIMARY KEY constraint ‘PK__%s’. Cannot insert duplicate key in object ‘%s’.

In this post, you’ll learn about the DB2 error 2627-Violation of PRIMARY KEY constraint ‘PK__%s’. Cannot insert duplicate key in object ‘%s’. and the reason why you are receiving the error message and how to fix it

How does this Error Message Looks like

2627 – Violation of PRIMARY KEY constraint ‘PK__%s’. Cannot insert duplicate key in object ‘%s’.

Reason for the Error & Solution

Duplicate values have been inserted into a primary key column that has a UNIQUE constraint. It is the responsibility of the application to deal with prevention of insertion of duplicate primary keys when using application identity.