Tomcat 4.0, MySQL and connection pools...


D

Darryl L. Pierce

I'm having a heck of a time getting connection pooling to work under Tomcat
4.0.6 with MySQL. I've done the following steps:

1. Copied the mysql.jar file into $TOMCAT_HOME/commons/lib, along with
commons-collections.jar, commons-dbcp.jar and commons-pool.jar

2. Placed the following default context into my server.xml file:

<DefaultContext>
<Resource name="jdbc/RapixDB" auth="Container"
type="javax.sql.DataSource" />

<ResourceParams name="jdbc/RapixDB">
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>

<parameter>
<name>driverName</name>
<value>jdbc:mysql://localhost/account</value>
</parameter>

<parameter>
<name>user</name>
<value>.....</value>
</parameter>

<parameter>
<name>password</name>
<value>.....</value>
</parameter>

<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>

<parameter>
<name>maxIdle</name>
<value>30000</value>
</parameter>

<parameter>
<name>maxWait</name>
<value>100</value>
</parameter>
</ResourceParams>
</DefaultContext>

3. Added the following to my web.xml file for my servlet:

<resource-ref>
<description>Proxy DB Connection</description>
<res-ref-name>jdbc/RapixDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

4. And am using standard JNDI calls to create my initial context and then
attempt to grab a data source.

Things fall apart on step #4 above. I consistently get a NamingException
thrown when I call InitialContext.lookup("java:comp/env/jdbc/RapixDB").

Any help?
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top