• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQLNestedException: Cannot create JDBC driver of class ''

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JDBC driver is installed. Other pages that use JDBC work. It's a configuration issue of some sort.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic