how to catch Duplicate entry violation error code code example
Example: check if sqlexception is duplicate entry java
try{
...
}catch(SQLException e){
if(e.getErrorCode() == 1062 ){
//duplicate primary key
}
}
try{
...
}catch(SQLException e){
if(e.getErrorCode() == 1062 ){
//duplicate primary key
}
}