Cannot create JDBC driver
843836Sep 24 2003 — edited Sep 26 2003Hi Everyone,
I am using Tomcat 4.1.27 and jdk 1.3.1_09. I am trying to connect to an Oracle 8 i database using a jsp/servlet application.
I am getting an SQLException on the ds.getConnection() line in the code below.
//ObjectMgr.java
Connection con;
try {
ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/tktmgr");
con = ds.getConnection(); // line 96
}
catch(Exception e){}
The Exception log is as follows:
java.sql.SQLException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'null'
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:541)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
at tktmgr.common.ObjectMgr.getConnection(ObjectMgr.java:96)
The JDBC portions of my app (tktmgr) in server.xml is as follows :
<Context path="/tktmgr" docBase="tktmgr"
debug="0" reloadable="true">
<Resource name="jdbc/tktmgr" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/tktmgr">
<parameter>
<name>user</name>
<value>xbusr6</value>
</parameter>
<parameter>
<name>password</name>
<value>xbusr6</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>driverName</name>
<value>jdbc:oracle:thin:@10.19.71.37:1521:tmtst</value>
</parameter>
</ResourceParams>
</Context>
The web.xml JDBC portion is as follows :
<resource-ref>
<description>
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
</description>
<res-ref-name>
jdbc/tktmgr
</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
I have my classes12.zip and classes111.zip and classes12.jar and classes111.jar in TOMCAT_HOME\common\lib. and the same entry in the classpath and path.
I don't know what I am missing. Please advise. Any pointers and suggestions are highly appreciated.
Thanks in Advance,
Andy.