1 Reply Latest reply on Apr 27, 2002 6:40 AM by Dirk Bogun

    Problem getting datasource reference in 3.0RC1

    Fred Yeomans Newbie

      Hi all,

      I am attempting to port a custom service from 2.4.4 to 3.0RC1. I am running into a problem accessing a datasource from within the service under 3.0.

      In the (working) 2.4.4 code, I create the datasource in the jcml file as follows:


      mysqlDS
      org.jboss.pool.jdbc.JDBCPoolDataSource

      jdbc:mysql://localhost:3306/WH_Distribution
      1200000
      username
      10
      password
      false
      false
      false
      true
      120000
      1800000
      false
      false
      1.0
      0


      and I access the datasource from my code as follows:

      Context ctx = new InitialContext();
      DataSource ds = (DataSource) ctx.lookup("java:/mysqlDS");

      This all works fine.

      Now, under 3.0, I have created a mysql-service.xml file, which appears to deploy correctly:


      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer


      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->

      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Minerva JDBC LocalTransaction ResourceAdapter

      <!--real attributes-->


      <config-property>
      <config-property-name>ConnectionURL</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>jdbc:mysql://fredyremote:3306/WH_Distribution</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>DriverClass</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>org.gjt.mm.mysql.Driver</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>UserName</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>username</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Password</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>password</config-property-value>
      </config-property>



      MySqlDS



      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->


      0
      50
      5000
      15
      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports
      reauthentication)-->
      ByContainer



      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager



      However, when I try to use the same code to get a datasource reference, I get a "Not Bound" exception. I have tried various names, "java:/MySqlDS", "MySqlDS", etc.

      Any suggestions?

      Thx
      Fred