tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject MySQL Hell
Date Wed, 22 Jan 2003 15:13:39 GMT

Hello all,

i have been breaking my brain trying to get connection pooling, using
Tomcat 4.1.12's build in dbcp, with mySQL 3.23.

I have followed the instructions on the how this should be done, and I am
getting an exception when I try to get a connection .. (like many other
people it seems)..  If anyone has solved this problem.. or has a link to a
forum where this problem is answered please let me know..

I have downloaded

I unzipped it and copied :
*  the contents of WEB-INF/lib to my lib folder
* contents of com to my WEB-INF/classes folder
* contents of org to my WEB-INF/classes folder (this *does* contain

This does not work.  My jsp test code follows, and the Exception occurs on

<%@ page language="java" import="java.sql.*, javax.sql.*, javax.naming.*"
errorPage="error.jsp" %>

      Context initContext = new InitialContext();
      Context envContext  = (Context)initContext.lookup("java:/comp/env");
      DataSource ds = (DataSource)envContext.lookup("jdbc/mehdi");
      Connection conn = ds.getConnection();


Exception is

java.sql.SQLException: Cannot load JDBC driver class


        <Context path="/mysql" docBase="mysql" debug="0" reloadable="true">

 <Logger className="org.apache.catalina.logger.FileLogger"
             prefix="localhost_DBTest_log." suffix=".txt"

  <Resource name="jdbc/mehdi"

  <ResourceParams name="jdbc/mehdi">

    <!-- Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.

    <!-- Maximum number of idle dB connections to retain in pool.
         Set to 0 for no limit.

    <!-- Maximum time to wait for a dB connection to become available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.

    <!-- MySQL dB username and password for dB connections  -->

    <!-- Class name for mm.mysql JDBC driver -->

    <!-- The JDBC connection url for connecting to your MySQL dB.
         The autoReconnect=true argument to the url makes sure that the
         mm.mysql JDBC Driver will automatically reconnect if mysqld closed
         connection.  mysqld by default closes idle connections after 8


running out of time, and hair.



To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message