是吗?
我刚从微软网站上看的资料
4.5 When does Microsoft Transaction Server automatically commit or abort a transaction?
Microsoft Transaction Server commits or aborts the transaction when the component that triggered creation of the transaction completes its work. The component signals that its work is complete by calling either SetComplete or SetAbort. SetComplete causes the transaction to commit; SetAbort causes the transaction to abort.
Microsoft Transaction Server will also commit or abort the transaction if the client releases its last reference to the component.
The following rules summarize when a transaction is committed or aborted.
· If the component calls SetComplete, the transaction commits as soon as the method call returns to the client, even if the client maintains a reference to the component.
· If the component calls SetAbort, the transaction aborts as soon as the method call returns to the client, even if the client maintains a reference to the component.
· If the component calls DisableCommit, the transaction aborts when the client releases its last reference to the component.
· If the component calls EnableCommit, the transaction commits when the client releases its last reference to the component.
If the component never calls SetAbort, SetComplete, DisableCommit, or EnableCommit, then the transaction commits when the client releases its last reference to the MTS component.
4.7 Why does Microsoft Transaction Server support automatic transactions?
Automatic transactions make it much easier to develop reliable component-based applications.
When using Microsoft Transaction Server, the programmer writes very little code that manages transactions. MTS automatically begins a transaction on behalf of an application component based upon the components' transaction property. Application programmers use the data access methods they are familiar with including ADO, RDO, OLE DB, JDBC, and ODBC. The underlying resource dispensers, such as the ODBC Driver Manager, transparently enlist the resources they manage in the component’s transaction. When each component completes its work, it informs Microsoft Transaction Server whether it wishes to commit or abort the transaction. When the final component completes its work, Microsoft Transaction Server determines the outcome of the transaction. If all of the components that participated in the transaction signified that the transaction should commit, then Microsoft Transaction Server will commit the transaction. If any component signified that the transaction should abort, Microsoft Transaction Server aborts the entire transaction.
Automatic Transactions make it easy to compose applications from independently authored components. Each component is marked to indicate its transaction requirements. Microsoft Transaction Server automatically initiates transactions and propagates transactions from component to component to satisfy these requirements. If any component that is participating in the transaction cannot commit the transaction, Microsoft Transaction Server ensures that the entire transaction is aborted. This makes it possible to build an application from components while allowing each component to enforce its portion of the business rules.
4.11 Can SQL Server transactions be used with Microsoft Transaction Server transactions?
Components can call BEGIN TRANSACTION, COMMIT TRANSACTION, or ROLLBACK TRANSACTION inside a transactional MTS component, although this is not recommended.
Calls to BEGIN TRANSACTION are ignored, as are calls to COMMIT TRANSACTION.
Calls to ROLLBACK TRANSACTION will abort the component's transaction even if the component calls SetComplete.
Components must not call BEGIN DISTRIBUTED TRANSACTION, PREPARE TRANSACTION, or SAVE TRANSACTION inside a transactional MTS component.