Bug #37326 | How to find the MYSQL error codes in Java when db exception occurs | ||
---|---|---|---|
Submitted: | 11 Jun 2008 3:05 | Modified: | 11 Jun 2008 4:28 |
Reporter: | ravi paramasivam | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | MYSQL 4.11 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | How to find the MYSQL error codes in Java when db exception occurs |
[11 Jun 2008 3:05]
ravi paramasivam
[11 Jun 2008 3:28]
Mark Matthews
> 1.Where can we get the mysql error codes and error text mapping? See the constants in com.mysql.jdbc.MysqlErrorNumbers, or the MySQL server manual. For at least two of the three cases you mention above, if you're using Connector/J 5.1.x, you will get concrete SQLException classes, for example MySQLSyntaxErrorException and CommunicationsException. > 2.Will these error codes displayed in SQLException.getErrorCode() Yes.
[11 Jun 2008 4:28]
ravi paramasivam
Thanks for the quick reply,We are using mysql version: 4.1.11-standard and mysql-connector-java-3.0.16-ga-bin.jar so with this can we just take mysql-connector-java-5.1.x-rc-bin.jar and check for the exceptions?.Will it be backward compatible? System is running commerically and hence we can't change the mysqversion as of now.But by giving the option we can change the connector/J jar file version. Please suggest how to proceed?. P.S *** Can we have some reference link for the sample code?