Bug #87848 JDBC Java Connector in version 8.0.7-dmr unusable with MySQL 8.0.3
Submitted: 23 Sep 2017 8:26 Modified: 25 Sep 2017 7:22
Reporter: Paweł Jaguś Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:8.0.7-dmr OS:Microsoft Windows
Assigned to: CPU Architecture:Any

[23 Sep 2017 8:26] Paweł Jaguś
Description:
The MySQL Java Connector in version became unsuable because of lack of query cache in MySQL version 8.0.3

Starting my Spring Boot application ends with the following exception.

Caused by: java.sql.SQLException: Unknown system variable 'query_cache_size'
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:121) ~[mysql-connector-java-8.0.7-dmr.jar!/:8.0.7-dmr]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.7-dmr.jar!/:8.0.7-dmr]
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:116) ~[mysql-connector-java-8.0.7-dmr.jar!/:8.0.7-dmr]
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:853) ~[mysql-connector-java-8.0.7-dmr.jar!/:8.0.7-dmr]
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:440) ~[mysql-connector-java-8.0.7-dmr.jar!/:8.0.7-dmr]
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[mysql-connector-java-8.0.7-dmr.jar!/:8.0.7-dmr]
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:221) ~[mysql-connector-java-8.0.7-dmr.jar!/:8.0.7-dmr]
        at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:310) ~[tomcat-jdbc-8.5.14.jar!/:na]
        at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203) ~[tomcat-jdbc-8.5.14.jar!/:na]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:735) ~[tomcat-jdbc-8.5.14.jar!/:na]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:667) ~[tomcat-jdbc-8.5.14.jar!/:na]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:482) ~[tomcat-jdbc-8.5.14.jar!/:na]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) ~[tomcat-jdbc-8.5.14.jar!/:na]
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) ~[tomcat-jdbc-8.5.14.jar!/:na]
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) ~[tomcat-jdbc-8.5.14.jar!/:na]
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ~[tomcat-jdbc-8.5.14.jar!/:na]
        at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) ~[spring-jdbc-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
        at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) ~[spring-jdbc-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
        ... 72 common frames omitted

How to repeat:
Connecting to a MySQL 8.0.3 database with Java Connector in version 8.0.7-dmr will always cause this exception.
[23 Sep 2017 9:44] Shane Bester
seen https://bugs.mysql.com/bug.php?id=87846 ?
[23 Sep 2017 11:26] Paweł Jaguś
No, I haven't. Somehow it didn't pop up in the search results (I search for the key word 'query_cache_size'. I will try to use connector in version 5.1.44 as a workaround for now. It surely does not work with the version 8.0.7-dmr.
[25 Sep 2017 7:22] Chiranjeevi Battula
Hello Paweł,

Thank you for the bug report.
Reported issue was fixed in internal Bug #26399958,  and per bug update it is fixed in 5.1.43/8.0.8 version. 
I'm marking this as dup of Bug #87846, which was reported for the same issue but for the lower version C/J 51.42. Since there was no change log exists and to avoid further confusion, Bug #87846 has been processed to handle the missing change log details. 

Thanks,
Chiranjeevi.