You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jaime Garcia Bonis <ja...@afina.es> on 2001/10/25 11:45:46 UTC

JNDI question

Hi evryone

    I have a question about how JNDI works in Tomcat 4.0.1
    How can i set up a JNDI naming repository in order to create a
datasource???

    In the server.xml i have this:

         <Resource name="jdbc/FtcAppDb" auth="CONTAINER"
                    type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/FtcAppDb">
            <parameter><name>user</name><value>scott</value></parameter>


<parameter><name>password</name><value>tiger</value></parameter>
            <parameter><name>driverClassName</name>
              <value>oracle.jdbc.driver.OracleDriver</value></parameter>

            <parameter><name>driverName</name>

<value>jdbc:oracle:thin:@zagarron:1521:orcl</value></parameter>
          </ResourceParams>

        Inside de Context tag of my application.

        In the web.xml i have this:

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

i get the datasource object doing this :DataSource ds =
(DataSource)ctx.lookup("jdbc/FtcAppDb");
but when i try to create the connection object i get a Null Pointer
exception error

Could anyone help me i don't have a clue about what happen.

Thanks for the time