Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes connection pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connection pool" Watch "connection pool" New topic
Author

connection pool

dhana logan
Greenhorn

Joined: May 28, 2003
Posts: 1
I want to use connection pool in my servlet.
This is the error message i am getting-
"Error Message is:java.sql.SQLException: Cannot load JDBC driver class 'null'"
I have made necessary changes in web and server.xml..
server.xml
-------------
<Resource name="jdbc/myoracle" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/myoracle">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbcracle:thin:myschema@127.0.0.1:1521:mysid</value>
</parameter>
<parameter>
<name>username</name>
<value>scott</value>
</parameter>
<parameter>
<name>password</name>
<value>tiger</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
web.xml
-----------
<resource-ref>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Here is my code..
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();
thanks in advance
Dave Jochim
Ranch Hand

Joined: Jan 08, 2003
Posts: 31
I'm not sure, but when you do the lookup with the context is it ... or without the leading slash before 'comp'?
Sorry I can't be more helpful.
 
wood burning stoves
 
subject: connection pool
 
Similar Threads
Databse Connectivity Error
Is this true: JNDI equals Connection Pooling
JNDI in webapps
Tomcat Database Connection Pooling Error
DBCP => Cannot create JDBC driver of class '' for connect URL 'null'