MySQL Java SQLException error codes enum

Because I had this problem and I could not find a list of MySQL error codes on the Internet, I’ve decided to implement my own MySQL error codes enum. It is based on MySQL 5.1.35 sources, include/mysqld_ername.h file.
Now I can do something like this:

catch (SQLException e) {
if(e.getErrorCode() == MySQLExceptionCode.ER_DUP_ENTRY.getErrorCode()){
} else

You can find the java file here.

Leave a Reply

Your email address will not be published. Required fields are marked *