I'd suggest looking at the comments in the examples for DBCP about how the examples need to be run. The required JDBC driver needs to be pre-loaded for it to work.
If you have any further questions you should probably send them to the commons mailing list. Hamish > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 22, 2003 4:14 PM > To: Tomcat Users List > Subject: MySQL Hell > > > > 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 mysql-connector-java-2.0.14.zip > > 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 > org.gjt.mm.mysql.Driver) > > This does not work. My jsp test code follows, and the > Exception occurs on > getConnection()... > > <%@ 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 > 'org.gjt.mm.mysql.Driver' > > SERVER.XML > > <Context path="/mysql" docBase="mysql" debug="0" > reloadable="true"> > > <Logger className="org.apache.catalina.logger.FileLogger" > prefix="localhost_DBTest_log." suffix=".txt" > timestamp="true"/> > > <Resource name="jdbc/mehdi" > auth="Container" > type="javax.sql.DataSource"/> > > <ResourceParams name="jdbc/mehdi"> > <parameter> > <name>factory</name> > <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> > </parameter> > > <!-- 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. > --> > <parameter> > <name>maxActive</name> > <value>100</value> > </parameter> > > <!-- Maximum number of idle dB connections to retain in pool. > Set to 0 for no limit. > --> > <parameter> > <name>maxIdle</name> > <value>30</value> > </parameter> > > <!-- 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. > --> > <parameter> > <name>maxWait</name> > <value>10000</value> > </parameter> > > <!-- MySQL dB username and password for dB connections --> > <parameter> > <name>username</name> > <value>mehdi</value> > </parameter> > <parameter> > <name>password</name> > <value>mypass</value> > </parameter> > > <!-- Class name for mm.mysql JDBC driver --> > <parameter> > <name>driverClassName</name> > <value>org.gjt.mm.mysql.Driver</value> > </parameter> > > <!-- 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 > the > connection. mysqld by default closes idle > connections after 8 > hours. > --> > <parameter> > <name>url</name> > > <value>jdbc:mysql://localhost:3306/mehdi?autoReconnect=true</value> > </parameter> > </ResourceParams> > > </Context> > > > running out of time, and hair. > > Thanks, > > Med > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>