« Tax Time | Main | Cruise Control admin script »

Jakarta Tomcat Database Connection Pooling

I've been working on a new Java web application that will make use of a relational database - MySQL, in this case. I have configured Database Connection Pooling (DBCP) for J2EE applications deployed on Oracle application server instances, but never for Tomcat. The documentation on the Tomcat site was a bit confusing: insert this information in the server.xml file. Okay, but where in the server.xml file? Anyhow, after some Googling I found a good tutorial.

I attempted putting a Context entry in the Tomcat server.xml, but was never able to get the connection pool registered in JNDI. There weren't any entries in the server log indicating a problem with my modifications to the server.xml. I was puzzled.

What eventually worked was placing the Context entry in the ${tomcat}/conf/Catalina/localhost/{app}.xml file. Bang. It worked. I wish that the documentation on the Tomcat website made mention of this file and its capabilities.