tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Cannot create JDBC driver of class
Date Thu, 29 Jul 2004 17:17:37 GMT
Hi,
Only declare the Resource once: it's EITHER GlobalNamingResources or a
Resource under your Context, but not both.

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Bussie, Andre D [mailto:andre.d.bussie@lmco.com]
>Sent: Thursday, July 29, 2004 1:13 PM
>To: tomcat-user@jakarta.apache.org
>Subject: Cannot create JDBC driver of class
>
>At a standstill with accessing a datasource through JNDI in Tomcat
>5.0.19.
>
>
>
>Snippet of server.xml
>
>...
>
><Context displayName="Jakarta Struts Testing Web Application"
>docBase="phone" path="/phone">
>
>  <Resource auth="Container" description="Database Connection for the
>phone web application" name="jdbc/phone" type="javax.sql.DataSource"/>
>
>  <ResourceParams name="jdbc/phone">
>
>    <parameter>
>
>                        <name>url</name>
>
>                        <value>jdbc:hsqldb.hsql://localhost</value>
>
>            </parameter>
>
>            <parameter>
>
>               <name>driverClassName</name>
>
>               <value>org.hsqldb.jdbcDriver</value>
>
>            </parameter>
>
>  </ResourceParams>
>
>  </Context>
>
>....
>
><GlobalNamingResources>
>
>...
>
><Resource name="jdbc/phone" type="javax.sql.DataSource"/>
>
>.......<ResourceParams name="jdbc/phone">
>
>      <parameter>
>
>        <name>maxWait</name>
>
>        <value>5000</value>
>
>      </parameter>
>
>      <parameter>
>
>        <name>maxActive</name>
>
>        <value>4</value>
>
>      </parameter>
>
>      <parameter>
>
>        <name>password</name>
>
>        <value></value>
>
>      </parameter>
>
>      <parameter>
>
>        <name>url</name>
>
>        <value>jdbc:hsqldb.hsql://localhost</value>
>
>      </parameter>
>
>      <parameter>
>
>        <name>driverClassName</name>
>
>        <value>org.hsqldb.jdbcDriver</value>
>
>      </parameter>
>
>      <parameter>
>
>        <name>maxIdle</name>
>
>        <value>2</value>
>
>      </parameter>
>
>      <parameter>
>
>        <name>username</name>
>
>        <value>sa</value>
>
>      </parameter>
>
>    </ResourceParams>
>
>
>
>....
>
>Here is a snippet of web.xml
>
><resource-ref>
>
>    <description>Database Connection for the phone web
>application</description>
>
>      <res-ref-name>jdbc/phone</res-ref-name>
>
>      <res-type>javax.sql.DataSource</res-type>
>
>      <res-auth>Container</res-auth>
>
>  </resource-ref>
>
>
>
>Snippet of context.xml
>
><?xml version='1.0' encoding='utf-8'?>
>
><Context displayName="Jakarta Struts Testing Web Application"
>docBase="phone" path="/phone">
>
> <ResourceLink name="jdbc/phone" global="jdbc/phone"
>type="javax.sql.DataSource"/>
>
></Context>
>
>
>
>
>
>Code Snippet
>
>Context ctx = new InitialContext();
>
>   Context env = (Context)ctx.lookup("java:comp/env");
>
>   DataSource ds = (DataSource) env.lookup("jdbc/phone");
>
>   Connection conn = ds.getConnection();
>
>   try{
>
>
>
>Error message received
>
>org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of
>class 'org.hsqldb.jdbcDriver' for connect URL
>'jdbc:hsqldb.hsql://localhost', cause:
>
>java.sql.SQLException: No suitable driver
>
>
>
> What more can I do to get this working?
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message