{"id":75,"date":"2009-06-05T16:02:27","date_gmt":"2009-06-05T14:02:27","guid":{"rendered":"http:\/\/www.zagura.ro\/index.php\/2009\/06\/05\/mysql-java-sqlexception-error-codes-enum\/"},"modified":"2009-06-05T16:10:55","modified_gmt":"2009-06-05T14:10:55","slug":"mysql-java-sqlexception-error-codes-enum","status":"publish","type":"post","link":"https:\/\/www.zagura.com\/blog\/index.php\/2009\/06\/05\/mysql-java-sqlexception-error-codes-enum\/","title":{"rendered":"MySQL Java SQLException error codes enum"},"content":{"rendered":"<p>Because I had <a href=\"http:\/\/lists.mysql.com\/java\/83\">this<\/a> problem and I could not find a list of MySQL error codes on the Internet, I&#8217;ve decided to implement my own MySQL error codes enum. It is based on MySQL 5.1.35 sources, include\/mysqld_ername.h file.<br \/>\nNow I can do something like this:<\/p>\n<p>[java]<br \/>\ncatch (SQLException e) {<br \/>\n                        if(e.getErrorCode() == MySQLExceptionCode.ER_DUP_ENTRY.getErrorCode()){<br \/>\n                                 r = Result.DUPLICATE_ACCOUNT_NO;<br \/>\n                        } else<br \/>\n                                 r = Result.DATABASE_ERROR;<br \/>\n}<br \/>\n[\/java]<\/p>\n<p>You can find the java file <a href=\"http:\/\/zagura.ro\/download\/MySQLExceptionCode.java\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Because I had this problem and I could not find a list of MySQL error codes on the Internet, I&#8217;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: [java] catch (SQLException e) { if(e.getErrorCode() == MySQLExceptionCode.ER_DUP_ENTRY.getErrorCode()){ r =&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,15,10],"tags":[],"_links":{"self":[{"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/75"}],"collection":[{"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=75"}],"version-history":[{"count":0,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/75\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zagura.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}