4 Replies Latest reply: Feb 12, 2007 7:42 AM by 807606 RSS

    "jdbc/SchoolDataSource"  is it a jndi name ?

    807606
      code snippet from the entity bean

      DataSource ds =(DataSource)ic.lookup(�java:comp/env/jdbc/SchoolDataSource�);



      "jdbc/SchoolDataSource" is it a jndi name ?
        • 1. Re: "jdbc/SchoolDataSource"  is it a jndi name ?
          807606
          because i have the followings

          ejb-jar.xml
          ----------------

          <resource-ref>
          <description>The reference to the
          DataSource.</description>
          <res-ref-name>jdbc/SchoolDataSource</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>



          weblogic-ejb-jar.xml
          -----------------------

          <resource-description>
          <res-ref-name>jdbc/StudentDataSource</res-ref-name>
          <jndi-name>StudentDataSource</jndi-name>
          </resource-description>
          • 2. Re: "jdbc/SchoolDataSource"  is it a jndi name ?
            807606
            Yes, yes it is.

            Since you're doing a JNDI lookup, it's most certainly a JNDI name.
            • 3. Re: "jdbc/SchoolDataSource"  is it a jndi name ?
              807606
              thats what i knew . but my understanding becomes dull when i found "jdbc/SchoolDataSource" comes under a tag <res-ref-name> not <jndi-name>

              so, this lookup method is looking up <res-ref-name> then ....not the actual jndi name "SchoolDataSource" (in weblogic-ejb-jar.xml) though they have a reference.

              is not the context lookup method really searches for the real JNDI name ?


              or whats the reason to make a 3 level reference that way ?
              • 4. Re: "jdbc/SchoolDataSource"  is it a jndi name ?
                807606
                The terminology is rather confusing in the documentation.

                I'd describe "java:comp/jdc/env/SchoolDataSource" as a URL, not a name. Even "jdbc/SchoolDataSource" is a path, not a name.

                When you do an initial context lookup you need the full URL, but some of the configuration attributes abreviate it, since they assume that all the URLs start with java:comp/env.

                Just to make it more irritating some kinds of OC4J resource apparently have to start java:comp/resource