Skip to Main Content

MySQLIntegrityConstraintViolationException: Duplicate entry

User_AYF65Feb 18 2017 — edited Feb 26 2017

Hi,

I have created a table with id as a primary key.

When I am entering same id again & I am getting following errors:

MySQLIntegrityConstraintViolationException: Duplicate entry

I am catching SQLException:

catch(SQLException se){

      //Handle errors for JDBC

      JOptionPane.showMessageDialog(null, "Testing");

      se.printStackTrace();

   }

The control enters into catch block &

Its printing "Testing". So exception is caught. So why i am getting this error. Some body please guide me how to handle this error.

Zulfi.

This post has been answered by User_AYF65 on Feb 26 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Mar 26 2017
Added on Feb 18 2017
6 comments
11,396 views