3 Replies Latest reply on Jan 15, 2007 3:43 PM by Peter Johnson

    How to use JNDI names?

    Kent Zhou Newbie

      The following code is used for finding out a datasource or ejb:

      InitialContext ic = new InitialContext();
      datasource = (DataSource) ic.lookup(myJNDIName);

      Question is:
      in JBOSS, it convert ENC name to JNDI name in jboss-web.xml
      If my ENC for datasource is java:comp/env/jdbc/myDataSource,
      In Web.xml it is jdbc/myDataSource,
      in jboss-web.xml it is java:/myDB

      Then what should I use for lookup?
      myJNDIName should be "java:comp/env/jdbc/myDataSource" or "dbc/myDataSource" or "java:/myDB"