Platform SDK: Transaction Server

IDtcToXaMapper::EnlistResourceManager

Used to tell the DTC Proxy to enlist on behalf of the XA resource manager. The EnlistResourceManager method must be called for every transaction that the connection is requested to be enlisted in.

HRESULT EnlistResourceManager (
DWORD        dwRMCookie,
DWORD *        pdwITransaction);

Parameters

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

dwRMCookie [in]
A cookie representing the RM which was obtained from the call to RequestNewResourceManager.

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 do a new enlistment.

E_UNEXPECTED
An unexpected error occurred.

XACT_E_CONNECTION_REQUEST_DENIED
The transaction manager refused to accept a connection.

XACT_E_CONNECTIONDOWN
Lost connection with DTC TM.

XACT_E_LOGFULL
TM has run out of log space.

XACT_E_NOTRANSACTION
No transaction corresponding to pdwITransaction.

Comments

This method causes the XA TM to enlist with the DTC TM on behalf of the XA resource manager.

Note

The EnlistResourceManager method should be called after the XA resource manager has the XID.

When called, a message is sent to the XA TM, which then enlists with the DTC TM. At the time of two-phase commit, this enlistment receives the prepare, commit, and abort messages which the XA TM translates into appropriate XA function calls such as xa_prepare, xa_commit, and xa_abort.

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