[jboss-user] [JCA/JBoss] - Re: Problem looking up XADatasource - Always returns Datasou

vickyk do-not-reply at jboss.com
Mon Oct 27 12:21:37 EDT 2008


"pradeeps" wrote : 
  | The connection that is gotten from this datasource is going to participate in a distributed transaction with JMS XA QueueConnectionFactory.  I am using the Atomikos JTA API. 
  | 
  | This distributed TX will happen only if both the resources support XA.
  | 
  | Are you recommending that I create the XADataSource object in my code and not look up using JNDI?
  | 
  | Thanks.
  | 
I assume that you must have Atomikos TM configured with the JBoss.Now when you are getting the connection from the xa-datasource the jca framework will transparently enlist the connection associated with the datasource in the ongoing transaction.
Here is the psuedo code :

UserTransaction utx = (UserTransaction) ctx.lookup("UserTransaction");
  | 
  | Getting JMS XA QueueConnectionFactory from JNDI
  | 
  | Getting JMS session which will also enlist the corresponding XAResource in the ongoing TX
  | 
  | DataSource ds = (DataSource) ctx.lookup("java:/pxDS");
  | Connection con = ds.getConnection(); // Here JCA will enlist the connection(precisely XAResource) in ongoing JTA transaction transparently.
  | utx.commit();
  | 



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184898#4184898

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184898



More information about the jboss-user mailing list