Programming for MS DTC

StepsTo program using Microsoft Distributed Transaction Coordinator (MS DTC)

  1. Connect to MS DTC using the DtcGetTransactionManager function. For information about MS DTC, see Microsoft Distributed Transaction Coordinator documentation.

  2. Get the IDBSession for each Sybase ASE connection you want to establish following the OLE DB steps.

  3. Call the ITransactionDispenser::BeginTransaction function to begin an MS DTC transaction and to obtain an OLE Transaction object that represents the transaction.

  4. Query ITransactionJoin from each IDBSession (OLE DB Connection) you want to enlist in the MS DTC transaction, and call JoinTransaction with the passed in parameter punkTransactionCoord as the Transaction object (obtained in Step 3).Currently, Sybase supports only the isolation level of ISOLATION LEVEL_READCOMMITTED for the distributed transaction, and does not support ITransactionOptions.

  5. To update a SQL Server, follow the OLE DB steps for creating and executing the IDBCommand.

  6. Call the ITransaction::Commit function to commit the MS DTC transaction. The Transaction object is no longer valid.