Problems with Oracle 9i Thin Driver


Web tier: servlets, JSP, Web frameworks: Problems with Oracle 9i Thin Driver

  1. Problems with Oracle 9i Thin Driver (3 messages)


    I am running Tomcat and Oracle 9i. I am trying to get my connection pooling working so I can use a JNDI. But I am having a problem.

    When I include everything in a jsp file it connects to the database and produces a result.

    Connection conn = null;

    conn = DriverManager.getConnection(

    When I have it in the Context I just get:
    A Java.nullpointerexception

    My server.xml is:
    With the same parameters for username and password as above.

    My servlet is:
    Context ctx = new InitialContext();
           if(ctx == null )
             throw new Exception("Oops - No Context");

           DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/database");

           if (ds != null)
             conn = ds.getConnection();

    All your help is appreciated:
  2. See the datasource howto in Tomcat's documentation:

    This explains everything quite well.
  3. Thanks,

    I did look at that but it only explains 8i, I didn't think it would be an issue to go to 9i but it is. Which is why I ask the question.

    What was listed on the Tomcat 5 Servlet/JSP Container - JNDI Datasource How-To did not help me with the problem.

    Any other ideas would be appreciated.

  4. Problems with Oracle 9i Thin Driver[ Go to top ]

    I put the driver in the TOMCAT_HOME/common/lib directory.

    Here's an excerpt out of my server.xml which shares an Oracle connection across multiple contexts (webapps). You'd probably need to change the username, password, and URL :)

     <Engine ... >
      <Host ... >

    <Resource name="dev" auth="Container"
    type="javax.sql.DataSource" />
    <ResourceParams name="dev">
      <!-- Other Context related Stuff -->