How an OLE Transactions Resource Manager Initiates a Transaction

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

OLE Transactions–compliant resource managers can initiate DTC transactions in either of the following ways:

  • Explicitly For example, an application such as a relational database that supports stored procedures might include a call in its stored procedure programming language that initiates a DTC transaction.

  • Implicitly For example, a database that supports stored procedures might implicitly initiate a DTC transaction when a stored procedure updates transaction-protected resources or when it invokes a remote stored procedure in another database.

Resource Manager Explicitly Initiated Transactions

Some OLE Transactions-compliant resource managers provide facilities for initiating and committing DTC transactions from within the resource manager. For example, a relational database system might provide stored procedure programming language calls or dynamic SQL calls for beginning, committing, and aborting the DTC transactions.

Resource manager explicitly initiated transactions offer the following developer advantages:

  1. Simplified application programming. The resource manager provides simple interfaces for beginning, committing, and aborting distributed transactions.

  2. Lowered cost of committing a transaction. When the resource manager initiates the DTC transaction, the transaction manager on the resource manager's system always acts as the transaction coordinator. This can reduce the cost of committing the transaction because the transaction manager on the client application's system need not participate in the two-phase commit protocol.

  3. Minimized setup and administration. You do not have to install the DTC on client machines.

Microsoft SQL Server is a resource manager that supports explicit initiation of the DTC transactions. See Example: How SQL Server Explicitly Initiates a Transaction for an example of how you can use SQL Server to exploit DTC transactions.

Resource Manager Implicitly Initiated Transactions

Some OLE Transactions resource managers may want to implicitly initiate the DTC transactions on behalf of an application. For example, Microsoft SQL Server implicitly initiates the DTC transactions when needed by a stored procedure.

There may be other uses for implicitly initiated DTC transactions. For example, a database system might automatically initiate a DTC transaction when no distributed transaction is in force and a stored procedure in one database system invokes a remote stored procedure in another database system. In this case, the database system that initiates the DTC transaction uses a single distributed transaction for the work done in both databases.

Resource manager implicitly initiated transactions are advantageous for the following reasons:

  1. Simplified application programming. Resource managers automatically initiate distributed transactions when required.

  2. Existing stored procedures can exploit DTC transactions. For example, Microsoft SQL Server starts a DTC transaction when a stored procedure calls the existing Transact-SQL BEGIN TRANSACTION statement and the database administrator has enabled the Remote Procedure Transactions option.

  3. Lowered cost of committing a transaction. When the resource manager initiates the DTC transaction, the transaction manager on the resource manager's system always acts as the transaction coordinator. This can reduce the cost of committing the transaction because the transaction manager on the client application's system need not participate in the two-phase commit protocol.

  4. Minimized setup and administration. There is no need to install the DTC on client machines.

Microsoft SQL Server is supports implicit initiation of the DTC transactions. See Example: How SQL Server Implicitly Initiates a Transaction for an example of how you can use SQL Server to exploit DTC transactions.

After a transaction is initiated, the DTC also facilitates transaction propagation. The following topics provide more information about transaction propagation involving OLE Transactions–compliant resource managers:

See Also

Example: How SQL Server Explicitly Initiates a Transaction
Example: How SQL Server Implicitly Initiates a Transaction