Cork Kochi
Cork Kochi

Reputation: 1891

MySQLSyntaxErrorException 'OPTION SQL_SELECT_LIMIT=DEFAULT'

Using mysql-connector-java-5.1.44-bin.jar and mysql version = 5.7.23 Using Spring Boot, the scheduler throws this error when app starts

o.s.scheduling.quartz.LocalDataSourceJobStore - Failed to override connection auto commit/transaction isolation.
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1
            at sun.reflect.GeneratedConstructorAccessor174.newInstance(Unknown Source)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
            at com.mysql.jdbc.Util.getInstance(Util.java:384)
            at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3562)
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494)
            at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
            at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
            at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2690)
            at com.mysql.jdbc.StatementImpl.executeSimpleNonQuery(StatementImpl.java:1545)
            at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1447)
            at com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3262)
            at com.zaxxer.hikari.pool.HikariProxyConnection.getTransactionIsolation(HikariProxyConnection.java)
            at org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.setTransactionIsolation(AttributeRestoringConnectionInvocationHandler.java:108)
            at org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.invoke(AttributeRestoringConnectionInvocationHandler.java:68)

Upvotes: 0

Views: 965

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562721

From the comments above, the problem turned out to be that an older version of the MySQL Connector/J was unexpectedly present. The Java CLASSPATH found the older version first.

Supporting my longstanding rule about Java:

enter image description here

Upvotes: 1

Related Questions