title: Connection time out issues after inactivity period
body: <p>We have an api which uses hibernate as ORM tool and we use c3p0 as the connection pool handler. We have no problems when we are under load. However, we are running out into "unable to obtain a connection" exceptions when the api has been inactive for a day or so. So, if no body uses the api over the weekend, we get connection errors on monday morning.</p>
  
  <blockquote>
    <p>Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.</p>
  </blockquote>
  
  <p>We use mysql as the database. On my research, i got to know that mySQL makes connections stale after 8 hours or so. It might be possible that the connection pool is giving out a stale connection to the client and hence the connection timeout exceptions for the client.</p>
  
  <p>At present, we do not have any connection testing configured in C3Po. Lets say, if I use IdleTestPeriod to test the connection before they are given to the client by the pool. Then what happens if all my connections fail the test at a point of time? Will those failed connections be removed from the pool and new active connections be generated again?</p>
  
  <p>Currently, this is the c3p0 settings that we are using. Any other reasons possible for this problem?</p>
  
  <pre><code>&lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt;
          &lt;property name="driverClass" value="${----}"/&gt;
          &lt;property name="jdbcUrl" value="${----}"/&gt;
          &lt;property name="user" value="${----}"/&gt;
          &lt;property name="password" value="${------}"/&gt;
          &lt;property name="minPoolSize" value="5"/&gt;
          &lt;property name="acquireIncrement" value="5" /&gt;
          &lt;property name="maxPoolSize" value="125" /&gt;
          &lt;property name="maxStatements" value="10" /&gt;
          &lt;property name="maxIdleTime" value="180" /&gt;
          &lt;property name="maxIdleTimeExcessConnections" value="30" /&gt;
          &lt;property name="checkoutTimeout" value="3000" /&gt;
          &lt;property name="preferredTestQuery" value="SELECT 1" /&gt;
      &lt;/bean&gt;
  </code></pre>