0 Replies Latest reply on Apr 8, 2015 8:41 AM by Lazar Dan

    JBoss datasource creation

    Lazar Dan Newbie

      Hi,

       

      JBoss creates datasource from *ds.xml files and I want to do this without such an xml file and still make JBoss provide datasources through jndi.

       

      The code that I have written registers 4 mbeans :

       

      RARDeployment at jboss.jca:service=ManagedConnectionFactory,name=" + dataSourceJndiUrl

      JBossManagedConnectionPool at "jca:service=ManagedConnectionPool,name=" + dataSourceJndiUrl

      TxConnectionManager at "jboss.jca:service=XATxCM,name=" + dataSourceJndiUrl

      WrapperDataSourceService at "jboss.jca:service=DataSourceBinding,name=" + dataSourceJndiUrl

       

      I would like to be able to retrieve a DataSource objects using the following code:

       

      InitialContext ctx = null;

      ctx = new InitialContext();

      DataSource ds = (DataSource) ctx.lookup(dataSourceJndiUrl);

       

      Can someone tell me if the above is a correct approach and if yes what else needs to be done in order for it to work?