Announcement Announcement Module
Collapse
No announcement yet.
BasicDataSource connection pooling - hangs Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BasicDataSource connection pooling - hangs

    Hey all.
    I'm using a long running process with JDBC/BasicDataSource connection pooling with Spring 2.5.1 as such:
    Code:
        <bean id="dataSource"
              class="org.apache.commons.dbcp.BasicDataSource"
              destroy-method="close"
              p:driverClassName="${DB.JDBCBridge.driver}"
              p:url="${DB.JDBCBridge.url}"
              p:username="${DB.JDBCBridge.user}"
              p:password="${DB.JDBCBridge.password}">
            <property name="initialSize" value="2"/>
            <property name="maxActive" value="15"/>
            <property name="poolPreparedStatements" value="true"/>
        </bean>
    The problem is that at some point it hangs seemingly when it is trying to get a connection. Here are the last statements in the log:
    JdbcTemplate.update(790): Executing prepared SQL update
    JdbcTemplate.execute(574): Executing prepared SQL statement [...]
    DataSourceUtils.doGetConnection(112): Fetching JDBC Connection from DataSource
    StatementCreatorUtils.setParameterValueInternal(20 7): Setting SQL statement parameter value: column index 1...
    StatementCreatorUtils.setParameterValueInternal(20 7): Setting SQL statement parameter value: column index 2...
    StatementCreatorUtils.setParameterValueInternal(20 7): Setting SQL statement parameter value: column index 3...


    Just before this call I log the db connection pool stats using:
    Code:
            BasicDataSource ds = (BasicDataSource) SpringBeans.getDataSource();
            int active = ds.getNumActive();
            int idle = ds.getNumIdle();
            logger.debug("******* Connection pool=> active[" + active + "], idle[" + idle + "]");
    This yields:
    ******* Connection pool=> active[4], idle[1]


    Now, if the connection pool max is 15 and the logging says I'm only using 4 with 1 idle, shouldn't I have some available still? Maybe I'm missing something simple. If there is a better way to debug this I'd appreciate the help.

    Thanks in advance for your advice.
Working...
X