FirebirdSQL logo
Ending Explicit Transactions

In SQL, a transaction is completed by a COMMIT or ROLLBACK request.ODBC has methods that do one or the other, such as SQLEndTran.Some programs are able to invoke SQLExecDirect but cannot call SQLEndTran.For those programs it is necessary to call an explicit

SQLExecDirect( hStmt, "COMMIT" )

to ensure that the interface will call

SQLEndTran( SQL_HANDLE_DBC, hConnection, SQL_COMMIT );
Note

If a transaction is initiated locally, the driver will execute SQLEndTran for the local hStmt.

Two Phase Commit Transactions

The ODBC/JDBC driver supports two-phase commit transactions, that is, a single transaction across different Firebird databases.Up to 16 databases can be accessed simultaneously in one such transaction — that is an absolute limit.

The call to start a two-phase commit transaction is:

SQLSetConnectAttr (connection, 4000, (void*) TRUE, 0);

To cancel the common connection:

SQLSetConnectAttr (connection, 4000, (void*) FALSE, 0);