2 Replies Latest reply on Jul 4, 2013 7:56 AM by Thomas Jodes

    What's the difference between <local-tx-datasource/> and <xa-datasource/>

    Thomas Chang Apprentice

      I see from a Jboss page (http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/Connectors_on_JBoss-Configuring_JDBC_DataSources.html) followings:

       

      local-tx-datasource : This element is used to specify the (org.jboss.resource.connectionmanager) LocalTxConnectionManager service configuration.

      LocalTxConnectionManager implements a ConnectionEventListener that implements XAResource to manage transactions through the transaction manager.

      To ensure that all work in a local transaction occurs over the same ManagedConnection, it includes a xid to ManagedConnection map. When a Connection is requested or a transaction started with a connection handle in use, it checks to see if a ManagedConnection already exists enrolled in the global transaction and uses it if found. Otherwise, a free ManagedConnection has its LocalTransaction started and is used.

       

       

      xa-datasource : This element is used to specify the (org.jboss.resource.connectionmanager) XATxConnectionManager service configuration.

      XATxConnectionManager implements a ConnectionEventListener that obtains the XAResource to manage transactions through the transaction manager from the adaptor ManagedConnection.

      To ensure that all work in a local transaction occurs over the same ManagedConnection, it includes a xid to ManagedConnection map. When a Connection is requested or a transaction started with a connection handle in use, it checks to see if a ManagedConnection already exists enrolled in the global transaction and uses it if found. Otherwise, a free ManagedConnection has its LocalTransaction started and is used.

       

       

      I couldn't tell the main difference between them. I just hear the xa-datasource can handle the so-called two-phase-transaction. This is the only difference, right?

       

       

       

      Thomas