JDBC Type 2 Driver Programmer's Reference for SQL/MX Release 3.1 (H06.23+, J06.12+)

Transactions
The JDBC/MX driver provides transaction support to maintain data integrity and consistency. To allow the
application to interleave transactions between SQL/MX objects and the traditional file system, the JDBC/MX
driver checks if a transaction is active whenever it needs to interact with SQL/MX.
The
transactionMode property determines transaction processing behavior. If you use transactionMode in a
typical environment, with the default value
mixed,
When an active transaction exists, the autocommit setting is ignored, and the JDBC/MX driver lets the
application manage the transaction.
When no active transaction exists, the JDBC/MX driver manages the transactions.
This implementation differs from JDBC/MP. In the JDBC/MP driver, two different types of URLs decide which
component manages the transaction.
If you are accessing
BLOB and CLOB data, see also Transactions Involving Blob and Clob Access.
Autocommit Mode and Transaction Boundaries
When JDBC/MX manages the transactions, the driver decides to start a new transaction. A new transaction
is started when no transaction is associated with the
Connection. When there is a transaction associated
with the
Connection, that transaction is resumed. The Connection attribute autocommit specifies when to
end the transaction. Enabling autocommit causes the JDBC/MX driver to end the transaction in accordance
with the following rules:
The JDBC/MX driver rolls back the transaction for any SQL error in SQL statements other than SELECT
statements.
In the case of non-SELECT SQL statements, the JDBC/MX driver commits the transaction if the current
transaction was started for this SQL statement.
In the case of SELECT statements, the JDBC/MX driver commits the transaction at the time of closing
the result set.
In the case of concurrent multiple SELECT statements, the JDBC/MX driver commits the transaction
only when the result set of the SELECT statement or the statement that started the transaction is
closed.
Disabling Autocommit Mode
When the autocommit mode is disabled, the application must explicitly commit or roll back each transaction
by calling the
Connection methods commit and rollback, respectively. When any SQL error occurs in SQL
statements other than SELECT statement, SQL/MX flags the transactions for aborting. In such a case, the
transaction is rolled back without regard to whether the application commits or rolls back the transaction.
The default is for auto-commit mode to be enabled when the Connection object is created. If the value of
auto-commit is changed in the middle of a transaction, the current transaction is committed. If
setAutoCommit is called and the value for auto commit is not changed from its current value, it is treated as
a NO-OP.