Trouble using JNDI with Tomcat and Oracle

From: Kiran (klingutla_at_hotmail.com)
Date: 02/09/04

  • Next message: qazmlp: "HAT reports leaks due to JDBC calls"
    Date: 8 Feb 2004 15:22:05 -0800
    
    

    Hi,
    I am using Tomcat5 and Oracle 9i and having trouble trying to connect
    to my database using JNDI.

    The Context tag in server.xml looks like this.

    <Context path="" docBase="ROOT" debug="1">
        <Resource name="jdbc/costanza" auth="Container"
    type="javax.sql.DataSource"/>
                  <ResourceParams name="jdbc/costanza">
                     <parameter>
                        <name>factory</name>
                      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                     </parameter>
                     <parameter>
                        <name>username</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>url</name>
                        <value>jdbc:oracle:thin@127.0.0.1:1521:costanza</value>
                     </parameter>
                   </ResourceParams>
              </Context>

    and the relevant portion in web.xml looks like this
    <resource-ref>
            <description>Accounts Database</description>
           <res-ref-name>jdbc/costanza</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
    </resource-ref>

    The SID of my database is costanza and I am able to connect to it
    using DriverManager. But when I use JNDI, I get the following error.

    org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
    of class '' for connect URL 'null', cause: No suitable driver

    It appears as if it's not reading the driverClassName and url tags. I
    get the same error when I remove the whole Context section from
    server.xml.

    I am struggling to solve this problem. Can anyone please help?

    Thanks in advance.
    -Kiran


  • Next message: qazmlp: "HAT reports leaks due to JDBC calls"

    Relevant Pages

    • Re: JDBC URL for Oracle Database With Failover (2 db servers)
      ... After you've loaded the driver, you can establish a connection using ... each form requires a database URL. ... For Oracle, the database URL has ...
      (comp.lang.java.databases)
    • RE: New JDBC 1.2 driver runs slower than JDBC 1.1; my db definitio
      ... If the support incident ends up verifying a slowdown in the new driver, ... New JDBC 1.2 driver runs slower than JDBC 1.1; ... I do think this would happen in general, not just for my database; ...
      (microsoft.public.sqlserver.jdbcdriver)
    • RE: Import external data - web query
      ... Your reply for my query is very extensive, this is for importing a file from ... The data source I want isn't listed in the Select Data Source dialog box. ... information used to connect to a database. ... Check your driver First, make sure you have the right ODBC driver (Open ...
      (microsoft.public.excel.misc)
    • Re: resultset is an iterator?
      ... >> done by the JDBC driver and the database backend. ... >> drag it all into memory but I have noticed that MySQL seems to do this. ... ResultSets are completely retrieved and stored in memory. ...
      (comp.lang.java.databases)
    • Re: MySQL JDBC driver - implications for non-GPLed apps
      ... >> driver a particular user wants to implement. ... MySQL AB does not purport to be our ... > care to provide a clear-cut explanation as part of their license agreement. ... >> However then you look at it, is the value of the driver and database ...
      (comp.lang.java.databases)