I have been looking for some good instructions on how to utilize connection pooling in Tomcat 6 connecting to Mysql 5, but there does not seem to be any complete references. I am having trouble piecing together different tutorials to get a clear picture.
I must admit, I am very much a beginner in dealing with Tomcat and it’s configurations.
Place the MySQL driver jar file in $TOMCAT_HOME/lib/
Make a META_INF/context.xml file in your webapp (The META_INF/ folder is at the same level as your WEB_INF/ folder) that looks e.g. like:
You probably have to replace path=”/tomcattest” docBase=”tomcattest” to match your webapp too.
You need to add a bit to your WEB_INF/web.xml too – the resource-ref section shown below. It might e.g. look like:
Now your servlets can fetch Connections from the pool by doing:
More info here