Committing and Rolling Back Transactions
Note Applications should not commit or roll back transactions by executing COMMIT or ROLLBACK statements with SQLExecute or SQLExecDirect. The effects of doing this are undefined. Possible problems include the
driver no longer knowing when a transaction is active and these statements failing
against data sources that do not support transactions. These applications should
call SQLEndTran instead.
If an application passes the environment handle to SQLEndTran but does not pass a connection handle, the Driver Manager conceptually calls SQLEndTran with the environment handle for each driver that has one or more active
connections in the environment. The driver then commits the transactions on each
connection in the environment. However, it is important to realize that the
neither the driver nor the Driver Manager performs a two-phase commit on the
connections in the environment; this is merely a programming convenience to
simultaneously call SQLEndTran for all connections in the environment.
(A two-phase commit is generally used to commit transactions that are spread across multiple data
sources. In its first phase, the data sources are polled as to whether they
can commit their part of the transaction. In the second phase, the transaction is
actually committed on all data sources. If any data sources reply in the first
phase that they cannot commit the transaction, the second phase does not
occur.)