|Product:||DB Connectivity ODBC Products|
|Summary:||Transaction support using two phase commit (2PC) with HiT ODBC/400 and HiT ODBC/DB2|
The HiT ODBC driver handles distributed transactions or Two Phase Commit. Distributed Transactions consist of several connections to different databases. When one connection is ready to commit a transaction, either all connections commit the transaction or, if one or more connections encounter a problem, the transaction is rolled back for all connections.
On Windows operating systems, distributed transactions are handled by the MSDTC (Microsoft Data Transaction Coordinator).
Two Phase Commit (2PC)
2PC is a protocol between the transaction manager and all the resources enlisted for a transaction, which ensures that either all the resource managers commit the transaction or they all abort. In 2PC, when the application requests to commit the transaction, the transaction manager issues a prepare request to all the resource managers. Each of these resources can, in turn, send a reply indicating whether it is ready for a commit or not. Only when all the resource managers are ready for a commit does the transaction manager send a commit request to all the resource managers. Otherwise, the transaction manager issues a rollback request and the transaction is rolled back.
Using Two Phase Commit (2PC) with HiT ODBC
To create an application that uses the 2PC feature, follow these steps:
- Create a COM+ Two-Phase Commit .DLL
- Register the .DLL
- Write an application that uses 2PC
- Create DSN's
- Run the application