Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Connection Pool To Access MySQL Database On Tomcat

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was reading the instructions to use connection pool to access MySql database on Tomcat 4.1.18. The instructions are at the web link below:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
I am confused and need help:
1. In the instruction, it says that DBCP uses the Jakarta-Commons Database Connection Pool. It relies on number of Jakarta-Commons componenets:
Jakarta-Commons DBCP 1.0
Jakarta-Commons Collections 2.0
Jakarta-Commons Pool 1.0
These jar files along with your the jar file for your JDBC driver should be installed in $CATALINA_HOME/common/lib.
Question: Where do I find those jar files. The links are not provided in the instruction.
2. To configure a DBCP DataSource so that abandoned dB connections are removed and recycled, add the following paramater to the ResourceParams configuration for your DBCP DataSource Resource.....
Question: I know how to add ResourceParams. But ... where do I configure DBCP DataSource Resrouce? In the server.xml? Which section in the server.xml?
Thank you for your help.
 
Mike Farnham
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer question #1:
You can find Jakarta Commons at:
http://jakarta.apache.org/commons/
 
Philip Shanks
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are using a late model Tomcat server, then DBCP is already present and functional. You don't need to install anything.
I advise that you also use the latest production JDBC driver for MySQL (com.mysql.jdbc.Driver).
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The newer version of Tomcat ship with an admin app.
http://localhost:8080/admin/index.jsp
There you can configure datasources.
Axel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic