Updating Two Databases from a Single Application

MS DTC is useful when an application must update two or more independent but related databases that are controlled by different resource managers. Consider an order entry application that registers an order and generates a bill for the customer. Order information is kept in the Order Item database. Billing information is kept in the Billing database. When an order is placed, both the Order Item database and the Billing database must be updated. The application developer can use MS DTC to ensure that these databases remain consistent by:

  1. Starting an MS DTC transaction.
  2. Enlisting the Order Item database and the Billing database on the transaction.
  3. Updating each of the databases by invoking the appropriate SQL statements or database-stored procedures.
  4. Committing the MS DTC transaction.

Updating Two Databases from a Single Application

When the transaction commits, MS DTC ensures that the updates to both databases are committed. In the event of a client application failure, a network connection failure, an Order Item database server failure, a Billing database server failure, or any combination of these failures, MS DTC aborts the transaction and instructs the resource managers to undo the effects of the transaction from both databases.