When the ODBC connection is initially obtained, it is in a local transaction state. An application enlists in a distributed transaction by setting the connection attribute SQL_ENLIST_IN_DTC and passing in a non-null transaction pointer. It remains in that state until the application sets the connection attribute SQL_ENLIST_IN_DTC with a null transaction pointer.
Transaction State Machine
When the connection transitions from the local transaction state to the distributed transaction state, the ODBC driver should call the RequestNewResourceManager method to obtain a RM cookie for the resource manager. The resource manager in this case is defined by the Data Source Name (DSN).
Note Driver implementers shouldn’t use the same RM cookie for two separate ODBC connections if the DSN on both connections is the same.
Calling RequestNewResourceManager results in a message from the DTC proxy to the XA TM. When the XA TM receives a message that contains the DSN and the name of the client DLL, it first checks to see if it already has an XA connection to the resource manager with the same DSN. If not, then the XA TM does the following:
Note In step 4, when the RM's xa_open function is called, the DTC TM passes in the DSN as the OPEN_STRING. The implementation of the xa_open function should create the appropriate OPEN_STRING based on the DSN. For example, if it needs any user id or security information, it can get that from the registry or anywhere else where it would have been stored at the time the DSN was created.
When the RequestNewResourceManager method call returns with a success two things are TRUE: