Discussion
The JDBC API uses SQLStates as a standard way of identifying error conditions in SQLExceptions. Prior to MySQL server version 4.1, Connector/J performed this mapping itself, as the server did not use SQLStates. MySQL server versions 4.1.0 send SQLState codes with error messages which Connector/J uses in SQLExceptions.
Prior to Connector/J version 3.1.3, a combination of SQL Standard and X/Open SQLStates were used for MySQL server versions older than 4.1.0.
Connector/J version 3.1.3 and newer use the SQL Standard SQLStates returned from the server (if available), or a mapping to SQL Standard SQLStates, unless the configuration property 'useSqlStateCodes' is set to 'false', which will cause the driver to use the older, 'legacy' SQLState mappings that Connector/J 3.0 used.