One-Pipe Resource Manager Connection

 

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

  1. The application calls SQLConnect in the ODBC driver manager passing the Data Source Name (DSN), user identifier, and Authentication string.

  2. The ODBC driver manager calls SQLConnect in the ODBC driver.

  3. The ODBC driver connects to the resource manager. Typically, the ODBC driver opens a non-transactional resource manager connection because it does not yet know whether the connection requires a transaction.

  4. The ODBC driver manager calls SQLSetConnectAttr(SQL_ATTR_ENLIST_IN_the DTC, pITransaction) in the ODBC driver. This instructs the ODBC driver to enlist in the specified transaction.

  5. If the ODBC driver already has a transactional connection open to the resource manager, it proceeds directly to one-pipe resource manager enlistment. If the ODBC driver has a non-transactional connection open to the resource manager, it closes it and then creates a new transactional resource manager connection as described in step 6.

  6. The ODBC driver calls the DtcGetTransactionManager function in the DTC proxy to establish a connection to the transaction manager. The resource manager specifies the name and location of the transaction manager it wants to use, usually specifying NULL values for these parameters. If NULL values are specified, the DTC proxy establishes a connection with the default DTC transaction manager, the name of which is contained in the system registry.

  7. The DtcGetTransactionManager system call is implemented by the DTC proxy. The DTC proxy returns a pointer to the IUnknown interface of the DTC proxy core object.

  8. The ODBC driver invokes QueryInterface on the DTC proxy core object to obtain the IDtcToXaHelperSinglePipe interface.

  9. The ODBC driver opens a new transactional connection to the resource manager by sending an xa_open_entry message to it.

  10. The ODBC driver invokes IDtcToXaHelperSinglePipe::XARMCreate, passing in the DSN name and the name of the ODBC driver DLL.

  11. The DTC proxy forwards the DSN name and the name of the ODBC driver DLL to the DTC transaction manager.

  12. The DTC transaction manager connects to the resource manager to ensure that it can do so if recovery is required. It records the information needed to reestablish the connection in its log file.

    • The DTC transaction manager calls the Win32 LoadLibrary function to load the ODBC driver DLL. It calls the Windows DLL function GetProcAddress to get the address of the GetXaSwitch function, which it calls to get the address of the XA switch data structure implemented by the ODBC driver.

    • The DTC transaction manager connects to the resource manager by calling xa_open_entry, using the DSN provided in the XARMCreate call. It then closes the resource manager connection by calling xa_close_entry.

    • The DTC transaction manager generates a resource manager GUID for each connection request it receives. The transaction manager writes a record to the DTCXATM.LOG file indicating that a new resource manager connection is being established. The log record contains the DSN name, the name of the ODBC driver DLL, and the resource manager GUID. The transaction manager uses this information to reconnect to the resource manager if recovery is necessary.

    • The transaction manager returns the resource manager GUID that it generated to the DTC proxy.

  13. The DTC proxy calls the DTC Connection Manager to establish a connection to the transaction manager.

  14. The transaction manager creates an internal object that represents the connection between the resource manager and the transaction manager. The transaction manager then returns to the DTC proxy.

  15. The DTC proxy creates a resource manager object and returns an opaque pointer to that object as the RMCookie, which represents the connection to the transaction manager.