Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use connection pool with java,MySQL and Tomcat 6

How can I use Connection pool in Java+MySQL+Tomcat 6?

I've read this article http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html but it is still not quite clear for me.

Where do I use the Connector/J? Do I put it in a static variable? Do I use a SessionListener? Does it need any configuration?

Thank you in advance!

like image 804
José Leal Avatar asked Dec 01 '08 00:12

José Leal


People also ask

Where do you configure a database connection pool in Tomcat server?

For configuring the connection pool for SQLServer you need to configure the SQLServer drivers as explained in the Microsoft SQL Server section and put the jar file into the TOMCAT_HOME/lib folder. Note that database name, username and password must be defined directly in the URL.

How does Tomcat JDBC connection pool work?

Tomcat jdbc pool implements the ability retrieve a connection asynchronously, without adding additional threads to the library itself. Tomcat jdbc pool is a Tomcat module, it depends on Tomcat JULI, a simplified logging framework used in Tomcat. Retrieve the underlying connection using the javax. sql.

Does MySQL support connection pooling?

X DevAPI supports connection pooling, which can reduce overhead for applications that open many connections to a MySQL Server. Connections are managed as a pool by a Client object.


1 Answers

You should read the Tomcat 6 JNDI document. Look for the "JDBC Data Sources" section and it will tell you everything you need to know about pooling connections with Tomcat.

like image 150
carson Avatar answered Oct 18 '22 08:10

carson