[CONJ-347] SQL syntax error generated by setTransactionIsolation() call Created: 2016-09-12  Updated: 2016-09-22  Resolved: 2016-09-22

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.5.2
Fix Version/s: 1.5.3

Type: Bug Priority: Major
Reporter: Jarek Gawor Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by CONJ-353 IBM jdk compatibility issue Closed

 Description   

Same exact code works with 1.4.6 version but with 1.5.2 it fails with:

SQLNonTransientException: 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 '' at line 1
Query is : SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED DSRA0010E: SQL State = 42000, Error Code = 1,064

Here's the full stack trace:

Caused by: java.sql.SQLNonTransientException: 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 '' at line 1
Query is : SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED DSRA0010E: SQL State = 42000, Error Code = 1,064
	at org.mariadb.jdbc.internal.util.ExceptionMapper.get(ExceptionMapper.java:125)
	at org.mariadb.jdbc.internal.util.ExceptionMapper.throwException(ExceptionMapper.java:69)
	at org.mariadb.jdbc.MariaDbConnection.setTransactionIsolation(MariaDbConnection.java:805)
	at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.setTransactionIsolation(WSRdbManagedConnectionImpl.java:4409)
	at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.synchronizePropertiesWithCRI(WSRdbManagedConnectionImpl.java:2383)
	at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.<init>(WSRdbManagedConnectionImpl.java:613)
	at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:676)
	at com.ibm.ejs.j2c.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1766)
	at com.ibm.ejs.j2c.FreePool.createOrWaitForConnection(FreePool.java:1489)
	at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:2903)
	at com.ibm.ejs.j2c.PoolManager.reserve(PoolManager.java:2244)
	at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:995)
	at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:643)
	at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:234)
	at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:205)
	at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)
	at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
	at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
	... 44 more
Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: 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 '' at line 1
Query is : SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1103)
	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:132)
	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:114)
	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.setTransactionIsolation(AbstractQueryProtocol.java:925)
	at org.mariadb.jdbc.MariaDbConnection.setTransactionIsolation(MariaDbConnection.java:803)
	... 59 more



 Comments   
Comment by Diego Dupin [ 2016-09-15 ]

Hi !
I don't succeed to reproduce the indicated error.
Can you send more informations : connection string, server version and configuration variable max_allowed_packet (select @@max_allowed_packet) ?

Comment by Jarek Gawor [ 2016-09-16 ]

Database product version : 5.5.29-rel29.4
max_allowed_packet: 16777216

There is no additional parameters in the connection string besides the db name (if that's what you are after).

Comment by Jarek Gawor [ 2016-09-16 ]

And if that helps, I see the same error with the 1.5.0 release candidate.

Comment by Diego Dupin [ 2016-09-21 ]

Seems that the issue is identified, can you confirm if runtime is IBM ?

Comment by Jarek Gawor [ 2016-09-21 ]

Yes. This was running with WebSphere Liberty and with IBM JRE 8.

Comment by Diego Dupin [ 2016-09-22 ]

fixed in 1.5.3 (will be released the oct. 3).

correction is available in snapshot release :

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>
 
<dependencies>
    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
        <version>1.5.3-SNAPSHOT</version>
    </dependency>
</dependencies>

Generated at Thu Feb 08 03:15:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.