I have finally figured this out!!!
(This should probably be in Tomcat section, instead of here in
JDBC)
From what I've seen in several other forums online regarding this problem, there might be either a bug in Tomcat v5.5, or the issue is not yet properly documented.
When trying to configure a web applications to access JDBC by using a DataSource to return a java.sql.Conncetion from Connection pool, you might encounter an
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' This occurs when trying to run this type of code:
I believe it could be because there was a problem creating the Context. This could be fixed by using 'attributes' in <Resource> tag of <Context> element, instead of <Parameter> as in prev Tomcat versions, then by placing <Resource> in CATALINA_HOME/conf/server.xml under <GlobalNamingResources> and then place a <ResourceLink> in the context.xml file.
Problem is, when trying to perform
you might still get a
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context So next you need to place a factory attribute in <Resource>. There is a default factory provided by Tomcat v5.5, but this doesn't seen to work for Connection pooling. So you can use
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" This works whether <Resource> is defined under <GlobalNamingResources> in server.xml for global access, and then <ResourceLink> is defined under <Context> for each application, or if <Resource> is placed under <Context> only. An example (saved as /META-INF/context.xml):
I hope this is helpful to someone!
[ June 15, 2006: Message edited by: kwame Iwegbue ]