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

    Oracle Dataset Setup and Usage

    jmschust

      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.

        • 1. Re: Oracle Dataset Setup and Usage
          davidjencks

          Assuming you are using jboss 3... if not, don't use service.xml file...

          1. Look in jndiview to check something is bound, and what.

          2.Make sure autodeployer is trying to deploy your jar after the oracle-service.xml file, you may have to put service.xml in deploy/lib or some such.

          3. (highly unlikely) If there are native libs with this driver, they may have to be in some well known location like in the jdk directory. This is unlikely to result in your datasource not being bound, however.

          • 2. Re: Oracle Dataset Setup and Usage
            jmschust

            Thanks David, for your response... I finally figured out what was going on... I wasn't using JBoss 3. So I got it all working puting in a definition into the jboss.jcml file.

            Now I'm trying out JBoss 3 on linux. I am using the oracleds-service.xml file and have everything in the right place I think, but I get an exception during startup that the oracle.jdbc.driver.OracleDriver class not found. I have put the classes12.zip file into the lib/ext directory. Any ideas?

            • 3. Re: Oracle Dataset Setup and Usage
              markd

              Rename classes12.zip to classes12.jar. There was a bug that has been fixed in Jboss-3.0.0. See http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/