0 Replies Latest reply on Mar 20, 2006 12:42 PM by srikanthpragada

    res-ref-name problem

    srikanthpragada

      Hello,

      I am using a bmp where i want to use a res-ref-name as follows in the code:

      private Connection getConnection()
      throws SQLException
      {
      InitialContext initCtx = null;
      try {
      initCtx = new InitialContext();
      DataSource ds = (javax.sql.DataSource) initCtx.lookup("java:comp/env/jdbc/oracle");
      return ds.getConnection();
      }
      catch(NamingException ne)
      {
      throw new EJBException(ne);
      }
      finally
      {
      try
      {
      if(initCtx != null) initCtx.close();
      }
      catch(NamingException ne) { throw new EJBException(ne); }
      }
      }


      My ejb-jar.xml res-ref entries are as follows:

      <resource-ref>
      <res-ref-name>jdbc/oraclel</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      My jboss.xml is a follows:
      <reference-descriptor>
      <resource-description>
      <res-ref-name>jdbc/oracle</res-ref-name>
      <jndi-name>java:/OracleDS</jndi-name>
      </resource-description>
      </reference-descriptor>


      I am not able to use the res-ref-name jdbc/oracle as shown in the code. Is java:comp/env/ is the prefix we use in JBoss. I used the same code previously with WLS 7.0 and it worked.

      Can any one help me to solve this problem?

      Thank you,
      Srikanth Pragada.