This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

useLocalTransactionState for mariadb connector/j

The Mysql Connector/J supports the useLocalTransactionState variable (https://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html) that can be used to short-circuit the constant "set auto-commit = 1" queries from the driver to MySql. Does the mariadb java connector have a similar option, or can this be accomplished in some way using the mariadb java connector?

Answer Answered by Diego Dupin in this comment.

MariaDB Java connector has some behavior equivalent to MySQL option useLocalTransactionState enable, to avoid executing unnecessary COMMIT and ROLLBACK commands when executing Connection.commit() / rollback() methods.

(This doesn't apply on Connection.setAutoCommit(boolean) method, because this command do not only commit the current transaction if any but also change auto_commit mode. So 'set autocommit=<boolean>' command will always be executed if changing mode)

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.