0 Replies Latest reply on Dec 14, 2003 3:48 AM by yuanwh

    Why the resource-ref can't work?

    yuanwh

      In my SessionBean's ejb-jar, I specify using the resource as following:(I use microsoft sqlserver 2000 as datasource)
      <resource-ref>
      <res-ref-name>MSSQLDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      Then in my bean code, I look up it like this:
      Context init = new InitialContext();
      DataSource dataSource = (DataSource)init.lookup("java:comp/env/MSSQLDS");
      return dataSource.getConnection();

      But as I run it, it throws an name-excpetion that reports "MSSQLDS not bound". And if I use "java:/MSSQLDS" to instead above call, it can work properly! Who can tell me what happened? Thanks!