[CONJ-269] handle server configuration autocommit=0 Created: 2016-03-24  Updated: 2016-03-24  Resolved: 2016-03-24

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: all
Fix Version/s: 1.4.0

Type: Bug Priority: Critical
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

Driver rely on status_flags with "SERVER_STATUS_AUTOCOMMIT" to know the autocommit state.

Problem is when server has autocommit set to false by configuration, this flag is always returning the 2 byte value (true).

That cause problems :

  • Since 1.3.0 version commit on autocommit connecton where throwing exception.
  • Since 1.3.4. to not be too hash with user, and some framework (like play that send commit even when in autocommit mode), Connection.commit send the "COMMIT" command to server only when in autocommit= false, so commit are never send in this case.

Correction cannot be done only server side, because driver must work with older database version. (and mysql and mariadb have the same problem).
So, the solution is to force the session value by "set session autocommit=1" when initializing the connection. After this command, server set correctly the status flag.



 Comments   
Comment by Diego Dupin [ 2016-03-24 ]

correction done in : https://github.com/MariaDB/mariadb-connector-j/commit/f566ca82510e8dfaa261fbc9f5d0dc4758b21e70
CI : https://travis-ci.org/MariaDB/mariadb-connector-j/builds/118213959

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