wood burning stoves 2.0*
The moose likes Tomcat and the fly likes SQLNestedException: Cannot create JDBC driver of class '' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "SQLNestedException: Cannot create JDBC driver of class Watch "SQLNestedException: Cannot create JDBC driver of class New topic
Author

SQLNestedException: Cannot create JDBC driver of class ''

Barry Gold
Greenhorn

Joined: Dec 15, 2005
Posts: 22
I am setting up a test environment for JSPs on my desktop machine. I have got Tomcat running, but when I try to use the database I get an error.

Here is the code:
String conStr = "java:comp/env/jdbc/<dbname>";
con = DBConnection.getConnection(conStr);

It fails on getConnection. I have a copy of mysql running, I can reach it from the command line and from PHP pages.

Here is the top of the <Host> entry, including the <Resource> for the database:
<Host name="localhost" appBase="C:/barry"
unpackWARs="true" autoDeploy="true" debug="1"
xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="suauto2006/public_html" path=""
swallowOutput="true" crossContext="true"
cookies="true" reloadable="false">
<Resource name="jdbc/suzuki_dealers" auth="Container"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="integrat" password="test99a"
url="jdbc:mysql://localhost:3306"
/>
</Context>

Here is the reference in my application's web.xml:

<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/(dbname)</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Here is the traceback:

rg.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'jdbc:mysql://localhost:3306'
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
com.<customer>.db.DBConnection.getConnection(DBConnection.java:73)
com.<name>.zip.utils.ZipValidation.initVal(ZipValidation.java:63)
com.<name>.zip.utils.ZipValidation.<init>(ZipValidation.java:48)
org.apache.jsp.<name>._jspService(<name>_jsp.java:203)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
[ July 07, 2006: Message edited by: Bear Bibeault ]
Chad Clites
Ranch Hand

Joined: Aug 16, 2005
Posts: 134
Is it possible that you don't have the JDBC driver in the correct location? I am pretty noobish at this myself, but I seem to remember a very similar error when I had the JDBC driver .jar in the wrong location.
Barry Gold
Greenhorn

Joined: Dec 15, 2005
Posts: 22
The JDBC driver is installed. Other pages that use JDBC work. It's a configuration issue of some sort.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQLNestedException: Cannot create JDBC driver of class ''
 
Similar Threads
Cannot create JDBC driver
configure SQL Server 2000 DataSource in Tomcat 5.0.28
resouce config problem
Problem in connection pooling
tomcat. dbcp.dbcp.BasicDataSource error but using javax.sql.DataSource