Bug #62038 Connector/J Driver reports itself as not jdbc compliant
Submitted: 30 Jul 2011 16:16 Modified: 2 Aug 2011 2:06
Reporter: Gerard Matte Email Updates:
Status: Not a Bug Impact on me:
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.17 OS:Any
Assigned to: Todd Farmer CPU Architecture:Any

[30 Jul 2011 16:16] Gerard Matte
Page 4 of the pdf documentation for the MySQL Connector/J states:
MySQL Connector/J is a JDBC Type 4 driver. Different versions are available that are compatible with the JDBC 3.0 and JDBC 4.0
specifications. The Type 4 designation means that the driver is pure-Java implementation of the MySQL protocol and does not rely on
the MySQL client libraries.

According to http://download.oracle.com/javase/6/docs/api/index.html?java/sql/Driver.html#jdbcCompliant...) all compliant jdbc drivers should return true for the java.sql.Driver jdbcCompliant() method.  The javadoc for this method states (in part):
Reports whether this driver is a genuine JDBC CompliantTM driver. A driver may only report true here if it passes the JDBC compliance tests; otherwise it is required to return false.
JDBC compliance requires full support for the JDBC API and full support for SQL 92 Entry Level. It is expected that JDBC compliant drivers will be available for all the major commercial databases.

The fact that the mysql driver reports itself as non-compliant was recently brought to a jboss community discussion at http://community.jboss.org/wiki/DataSourceConfigurationInAS7#Installing_a_JDBC_driver_as_a...

How to repeat:
Instantiate the com.mysql.jdbc.Driver and call method jdbcCompliant()
The result seems to always be false.

Suggested fix:
If the MySQL driver fails part of the compliance tests and that is the reason they declare themselves to be non-compliant that fact should be stated in the Connector/J documentation.

Otherwise the method should return true.
[30 Jul 2011 16:39] Karsten Wutzke
Linked from: http://forums.mysql.com/read.php?39,428770

I can also confirm this bug for version 5.1.13.
[1 Aug 2011 1:36] Todd Farmer
Hello Gerard,

You are correct; Driver.jdbcCompliant() is hard coded to return false:

	 * Report whether the driver is a genuine JDBC compliant driver. A driver
	 * may only report "true" here if it passes the JDBC compliance tests,
	 * otherwise it is required to return false. JDBC compliance requires full
	 * support for the JDBC API and full support for SQL 92 Entry Level.
	 * <p>
	 * MySQL is not SQL92 compliant
	 * </p>
	 * @return is this driver JDBC compliant?
	public boolean jdbcCompliant() {
		return false;

The comments suggest that the root cause is server non-compliance with SQL 92 standards; it is unclear at this time whether this was evaluated against the SQL 92 Entry Level standards or some higher level, or whether the specific concerns which caused this to be reported as false previously have subsquently been addressed.  We'll investigate this with our SQL standard experts.
[1 Aug 2011 22:52] Mark Matthews
Oddly enough, one can pass the JDBC compliance tests, and *not* be SQL-92 compliant. This method in the JDBC API should probably be re-documented, or changed.
[2 Aug 2011 2:06] Todd Farmer
Hello Gerard,

Our SQL standards experts indicate that we should not claim SQL 92 Entry Level compliance (specifically noting delimited identifiers and check constraints as areas where MySQL is non-compliant).  As a result, we cannot claim compliance per the JDBC API documentation.  As Mark notes, it's a bit odd that we can be fully JDBC spec compliant, but still have to return false because of server-side non-compliance with SQL 92 spec.
[1 Feb 2017 10:55] Roman Syroeshko
Still actual for WildFly 10.1.0.Final and MySQL CE 5.7.17. The application server returns:
"2017-02-01 11:40:07,159 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 36) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)".