Shreyas Kaushik wrote:


When there is a call to DataSource's getConnection() method, this will happen on the framework's/app server's DataSource. If the underlying DataSource is a XADataSource, a call to getConnection() method gives out a XAConnection. This is wrapped as java.sql.Connection and returned back to the application.


Not sure what you mean here.

The application code will always be interacting with a ConnectionFactory provided by the appserver that happens to implement DataSource. A call to getConnection() on this factory will be brokered by the ConnectionManager long before the driver's implementations are used.

In other words, in a managed connection scenario such as an appserver the application code can never call getConnection() on an XADataSource.

If the application is trying to do XA manually, then it will be getting XAConnection's from the XADataSource, doing work on a (pooled) connection obtained from the XAConnection and managing transactions using its XAResource. Again it should never get a physical, non-XA connection from the underlying implementation of XADataSource.

--
Jeremy

Reply via email to