Tomcat's connection pool opens only 20 connections to mysql

Posted by stck on Server Fault See other posts from Server Fault or by stck
Published on 2009-12-22T14:16:08Z Indexed on 2010/04/21 17:03 UTC
Read the original article Hit count: 201

Filed under:
|
|

I have a java application with following line in context.xml

<Resource 
    driverClassName="com.mysql.jdbc.Driver" 
    maxActive="100" 
    maxIdle="30" 
    initialSize="10" 
    maxWait="7000" 
    name="jdbc/app" 
    password="pass" 
    type="javax.sql.DataSource" 
    url="jdbc:mysql://dbhost:3306/dbname?autoReconnect=true" 
    username="user" 
    validationQuery="SELECT 1" 
    removeAbandoned="true" 
    removeAbandonedTimeout="30" 
    logAbandoned="true" 
/>

In mysql 'show variables' tells me that max_connections is 151.

Still,

use information_schema;
select count(*) from processlist where User = 'user';

never shows me more than 20 connections. On tomcat's catalina.out -log I get

Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
        at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:103)
        at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
        at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
        at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)

What should I check for to find the problem?

© Server Fault or respective owner

Related posts about tomcat

Related posts about mysql