共用方式為


IDtcToXaHelperSinglePipe::EnlistWithRM

 

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

The EnlistWithRM method instructs the DTC proxy to enlist on behalf of the XA resource manager. The IDtcToXaHelperSinglePipe::EnlistWithRM method must be called for every transaction that the connection is requested to be enlisted in.

This method causes the DTC proxy module to enlist with the DTC transaction manager module on behalf of the XA resource manager. The EnlistWithRM method should be called after the XA resource manager has the XID. At the time of two-phase commit, this enlistment receives the prepare, commit, and abort messages which are in turn delivered on the ITransactionResourceAsync interface supplied by the ODBC driver. The ODBC driver should then translate the callbacks into appropriate XA function calls such as xa_prepare_entry, xa_commit_entry, and xa_abort_entry on the real resource manager.

If this method fails, the ODBC driver must call IDtcToXaHelperSinglePipe::ReleaseRMCookie using the cookie specified in dwRMCookie.

Syntax

  
HRESULT EnlistWithRM (   DWORD dwRMCookie,  ITransaction * pITransaction,  ITransactionResourceAsync * pRes,  ITransactionEnlistmentAsync ** ppIEnlist);  

Parameters

dwRMCookie
[in] The cookie obtained by calling IDtcToXaHelperSinglePipe::XARMCreate.

pITransaction
[in] A pointer to the ITransaction interface that the application passes in as a value for the SQL_ENLIST_IN_DTC connection attribute.

pRes
[in] A pointer to the ITransactionResourceAsync interface. The ODBC driver is responsible for implementing the ITransactionResourceAsync interface. This interface includes the PrepareRequest, CommitRequest, AbortRequest and TMDown callback methods. The transaction manager invokes these resource manager callback methods to deliver phase one and phase two notifications to the ODBC driver.

ppIEnlist
[out] The DTC proxy returns the ITransactionEnlistmentAsync interface pointer to the ODBC driver. The ITransactionEnlistmentAsync interface contains the PrepareRequestDone, CommitRequestDone, and AbortRequestDone methods. These are the transaction manager-implemented methods that the ODBC driver invokes after successfully processing an asynchronous PrepareRequest, CommitRequest, or AbortRequest.

Return Values

S_OK
Success.

E_FAIL
TM enlisted failed.

E_INVALIDARG
One or more of the parameters are not valid.

E_OUTOFMEMORY
Unable to create a new enlistment due to lack of memory.

E_UNEXPECTED
An unexpected error occurred.

XACT_E_CONNECTION_DENIED
The transaction manager refused to accept a connection.

XACT_E_CONNECTION_DOWN
Lost connection with DTC transaction manager.

XACT_E_LOGFULL
transaction manager has run out of log space.

XACT_E_NOTRANSACTION
No transaction corresponding to pdwITransaction.

Requirements

For an explanation of the requirement values, see Requirements (Component Services).

Platforms: Windows Server 2016, Windows 10, Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista

Header: Declared in oletx2xa.h

See Also

IDtcToXaHelper
IDtcToXaHelperFactory
IDtcToXaMapper