6. Working with Transactions and Handling Errors : Two Phase Commit : Statements that Support Two Phase Commit
 
Share this page                  
Statements that Support Two Phase Commit
SQL provides the following two statements that support two phase commit functionality:
PREPARE TO COMMIT
The PREPARE TO COMMIT statement allows the coordinator application to poll each local DBMS to determine if the local DBMS is ready to commit the local transaction associated with the specified distributed transaction. Using this statement, the coordinator application can ensure that a distributed transaction is committed only if all of the local transactions that are part of the distributed transaction are committed. When the PREPARE TO COMMIT statement successfully completes, the local transaction is in a willing commit state.
CONNECT
The CONNECT statement, when specified with the distributed transaction ID, provides the means for a coordinator application to re-connect to a local DBMS, if the original connection was severed for any reason, for the purposes of committing or aborting a local transaction associated with the specified distributed transaction. When a local transaction is in the willing commit state, the coordinator application controls further processing of that transaction.