Exception: Error: Duplicate entry 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
}
}