3 Replies Latest reply on Dec 6, 2001 10:18 AM by Mark Desrosier

    Oracle Dataset Setup and Usage

    Joel Schuster Newbie

      Ok, I'm using the 'oracleds-service.xml' found in the tutorial documentation for database pool setup. One exception is that I'm using jdbc.oracle.oci8:@ instead of the thin client so I can use the TNSNAMES.
      And changed to this in the oracleds-service.xml file:
      OracleDS

      I've place the oracleds-service.xml file in the 'deploy' directory along with the jar file for the bean that uses oracle.

      I get connectivity to the bean but not from the bean to oracle.

      I've edited my jboss.xml adding these lines:
      <resource-ref>
      <res-ref-name>jdbc/OracleDS</res-ref-name>
      <jndi-name>java:/OracleDS</jndi-name>
      </resource-ref>

      I've edited my ejb-jar.xml adding these lines:

      <!-- JDBC DataSources (java:comp/env/jdbc) -->
      <resource-ref>
      The Oracle DS
      <res-ref-name>jdbc/OracleDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      when jboss server start up I get this line in the log:

      [Container factory] Binding resource manager: java:/OracleDS to JDNI ENC as: jdbc/OracleDS

      which all looks very good. HOWEVER, when using this code to connect to the datasource:

      String dbName = "java:/OracleDS";
      InitialContext ic = new InitialContext();
      DataSource ds = (DataSource) ic.lookup(dbName);
      Connection con = ds.getConnection();

      I get this error:

      javax.ejb.CreateException: OracleDS not bound

      I've tried different combinations of dbName :

      comp/env/jdbc/OracleDS
      jdbc/OracleDS

      with and without prefixed slashes and all I get is the either 'OracleDS not bound' or 'jdbc not bound'

      I hope this is all the info thats needed for some guru out there to help me out.

      Thanks in advance.