Setting Up C3P0 Connection Pooling on Apache Tomcat
My using this configuration on my Apache Tomcat 7 for my heavy-load application, and it runs very well. I put this code on context.xml under Apache Tomcat’s conf folder.
<Resource name="myconnection" auth="Container" driverClass="com.mysql.jdbc.Driver" jdbcUrl="jdbc:mysql://localhost:3306/mydatabase" user="root" password="xxxx" factory="org.apache.naming.factory.BeanFactory" type="com.mchange.v2.c3p0.ComboPooledDataSource" maxPoolSize="50" minPoolSize="15" acquireIncrement="3" acquireRetryAttempts = "0" acquireRetryDelay = "3000" breakAfterAcquireFailure = "false" maxConnectionAge = "60" maxIdleTime = "30" maxIdleTimeExcessConnections = "10" idleConnectionTestPeriod = "15" testConnectionOnCheckout = "true" preferredTestQuery = "SELECT 1" debugUnreturnedConnectionStackTraces = "true" autoCommitOnClose="true" />
I use MySql’s command “SHOW PROCESSLIST” for checking on opened connection to MySql.
I hope it helped others.
1 Comment
Jeryl Cook
about 6 years agoThanks :)
Reply