2 Replies Latest reply on Mar 14, 2003 10:06 AM by Carfield Yim

    How to remove the first '/' in the name of datasource?

    Carfield Yim Newbie

      JBoss will always insert the '/' between "java:" and the JNDI name, e.g.: If I set the following in datasource.xml

      testdb

      I will use the following code to get the datasource:

      DataSource ds = (DataSource)ic.lookup("java:/testdb");

      which somehow work fine if I only use jboss.

      However, if I need to port the application to tomcat, the way tomcat config the datasource is





      And the use the following code to locate JNDI source

      DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/testdb");

      I think I can change the datasource of jboss config file to
      comp/env/jdbc/testdb

      then I can use the following code to get the datasource:

      DataSource ds = (DataSource)ic.lookup("java:/comp/env/jdbc/testdb");

      However, how to tell jboss to remove the extra '/'??