If the webapps.xml file is supposed to be located in Catalina\localhost, the
apache's own website documentation JDBC-HOWTO needs to be updated to reflect
that new situation.  I'm surprised they haven't updated it because I'm sure
a lot of other people are going to be having the same problems I am.

I have made all of the changes you have suggest.  the mysql.jar file has
been deleted everywhere except for {CATALINA_HOME}/shared/lib where I have
now placed it.

I have created a file called DBTest.xml over in
/conf/Catalina/localhost/DBTest.xml

I used your template for the XML find changing it where it needs changes for
URL and username/password.

Still getting the same error message :(
So now what could it be?

-----Original Message-----
From: Jan Behrens [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 30, 2004 1:58 AM
To: 'Tomcat Users List'
Subject: RE: Tomcat -> MySQL = No suitable driver ERROR


Hi Patrick,

the problem might be that in Tomcat 5.x the storage of the context related
configuration changed from server.xml to a sepparate file for each webapp.
This file should be stored under
{Catalina_Home}\conf\Catalina\{domain-name}\myWebAppName.xml where
Catalina_Home points to your Tomcat installation dir and domain_name usually
would be localhost in a dev-environment. 

If you have a webapp called myWebApp and want to setup a datastore via jndi
for same to use in Tomcat 5 you could use the following as a basis for a
myWebApp.xml file stored under
{Catalina_Home}\conf\Catalina\{domain-name}\myWebAppName.xml:


<?xml version='1.0' encoding='utf-8'?>
<Context debug="5" displayName="myWebApp" docBase="myWebApp "
path="/myWebApp" reloadable="true"
workDir="work\Catalina\localhost\myWebApp">

  <Resource auth="Container" name="jdbc/myWebApp"
type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/myWebApp">
    <parameter>
      <name>url</name>
 
<value>jdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?autoRec
onnect=true</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>15</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>50</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>
    <parameter>
      <name>removeAbandoned</name>
      <value>true</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>USERNAME</value>
    </parameter>
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
      <name>removeAbandonedTimeout</name>
      <value>60</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>PASSWORD</value>
    </parameter>
  </ResourceParams>
</Context>

The MySQL driver does have to go under {Catalina_Home}\shared\lib! Delete
any other copies you might have placed in your WEB-INF\lib or anywhere else.
You should also remove the <context>....</context> you inserted in
server.xml as this should all go in the myWebApp.xml file. 

If you ever deploy your webapp you then only have to copy your myWebApp.xml
to the Manifest dir in your webapp root dir before creating the war-file and
Tomcat will automatically create the correct context for your webapp.

HTH, Jan


This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential or privileged
information.  Any unauthorized review, use, disclosure or distribution is
prohibited.  If you are not the intended recipient, please contact the
sender by reply e-mail and destroy the message.

Reply via email to