0 Replies Latest reply on Apr 5, 2004 7:28 AM by ritukedia

    How to access XADataSource in JBoss 3.2.x?

    ritukedia

      My requirement is to do manual Tx Management for a distributed scenario. One of the participants in this distributed scenario is Oracle. So I need the XAResource for my Oracle Connection.
      Ideally I expected the JNDI lookup for my XAOracleDS to return an XADataSource, but instead it returns org.jboss.resource.adapter.jdbc.WrapperDataSource. And WrapperDataSource has no public method to access the XADataSource or the XAConnection. How do I get the XAConnection?

      Any help will be greatly appreciated. I have spent a lot of time searching all forums but did not find any piece of code that does this. Please help...

      I am running JBoss 3.2.x and have defined oracle-xa-ds.xml in server/default/deploy directory:

      <xa-datasource>
      <jndi-name>XAOracleDS</jndi-name>
      <track-connection-by-tx>true</track-connection-by-tx>
      <isSameRM-override-value>false</isSameRM-override-value>
      <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
      <xa-datasource-property name="URL">jdbc:oracle:oci8:@ritu:1521:qadb</xa-datasource-property>
      <xa-datasource-property name="User">xyz</xa-datasource-property>
      <xa-datasource-property name="Password">xyz</xa-datasource-property>
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      </xa-datasource>


      Java Code that Loads the XADataSource

      Context initCtx = new InitialContext();
      WrapperDataSource xads = (WrapperDataSource) envCtx.lookup("jdbc/MyXADS");
      Connection con = xads.getConnection();

      Regards,
      Ritu