tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: JNDI + Tomcat + Oracle 9i Database
Date Tue, 25 Feb 2003 19:37:08 GMT
This issue has been asked and answered again and again in the mailing list
of tomcat, struts, and commons. Consider that Oracle is so populate, setup
should be pretty straightforward.

My advice is to make sure that you have read carefully the tomcat datasource

My environment is

J2sdk 1.4.1_01 <= 1.4
Tomcat 4.1.18
Apache 2.0.44
Tomcat Connector 2.0.3
Red Hat Linux 7.2 (prod)
Windows 2000 (dev)
Oracle 8.1.7
classes12.jar <= 1.2

1. Below is part of my context. Do not invent the resource type, driver, and
factory. I saw someone use a different factory or driver think they are
going to utilize Oracle's pooling. It is smart but it is wrong in this case.
To prove it is wrong, read Tomcat source code.

<Resource name="jdbc/abcd"

<ResourceParams name="jdbc/abcd">

2. Also in my app's web.xml

	<description>Oracle Datasource</description>

Do not put commons-dbcp and pooling jars in your app's WEB-INF/lib, use
Tomcat's (in common/lib).

3. Initialize the connection pool and get connection:

Context initContext = new InitialContext();
Context envContext = (Context) initContext.lookup("java:comp/env");
DataSource dataSource = (DataSource) envContext.lookup("jdbc/abcd");

Don't do anything other than point 3 to get the connection or driver.

I have had two problems before:

- null driver: renamed to classes12.jar and put it ONLY in
- cannot connect: use a real url other than Microsoft's name, so oratest
won't work on linux while works.
- cast exception: use commons dbcp and pooling in commons/lib.

"This Guy Thinks He Knows Everything"
"This Guy Thinks He Knows What He Is Doing"

-----Original Message-----
From: "Sebastião Carlos Santos" [] 
Sent: February 25, 2003 1:37 PM
Subject: Re: JNDI + Tomcat + Oracle 9i Database

When I made the change of the <name>url </ name> for <name>URL </ name>
started to receive the following error message  
Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' it goes
connect URL 'null'  
Going back to the configuration <name>url </ name>  
Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' it goes
connect URL ''

Taking advantage of the opportunity, which driver JDBC should use,
ojdbc14.jar (for the jdk 1.4) or, that should have the name
according to the documentation changed for classes12.jar

Sebastião Carlos Santos
Oracle Database Administrator 
Universidade Federal de Uberlândia - UFU
Gratificação de Estímulo à Docência - GED

To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message