The components work together to process transactions from initiation through completion.
The AP delimits transaction boundaries. An AP informs the TM, via TX calls, that a global transaction is beginning. The TM then communicates with all available RMs, via XA calls, to associate a single transaction identifier with any work the RMs will do on behalf of the AP within the bounds of the global transaction.
When the AP requests that the TM commit the global transaction, the TM and the RMs use the two-phase commit protocol to guarantee transaction atomicity.
Transaction completion takes place in two phases—the prepare phase and the commit phase. For a detailed description of the two-phase commit protocol, see the Open Client DB-Library/C Reference Manual.
In the prepare phase, the TM requests each RM to prepare to commit its portion of the global transaction. This portion is known as a transaction branch.
In the commit phase, the TM instructs the RMs to commit or abort their branches of the transaction. If all RMs report back that they have prepared their respective transaction branches, the TM commits the entire transaction. If any RM reports that it was unprepared or fails to respond, the TM rolls back the entire transaction.
Figure 2-2 shows a typical transaction branch structure.