title: There are not enough idle connections in Tomcat JDBC pool
body: <p>Given the following Tomcat JDBC connection settings:</p>
  
  <pre><code>&lt;Resource name="jdbc/pc4"
              maxActive="200"
              maxIdle="100"
              minIdle="50"
              initialSize="50"
              maxWait="15000"
              auth="Container"
              type="javax.sql.DataSource"
              username="....."
              password="....."
              testOnBorrow="true"
              testWhileIdle="true"
              validationQuery="select 1"
              driverClassName="com.mysql.jdbc.Driver"
              factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
              url="jdbc:mysql://server_address/db_name?autoReconnect=true&amp;amp;autoReconnectForPools=true&amp;amp;zeroDateTimeBehavior=convertToNull&amp;amp;useUnicode=true&amp;amp;characterEncoding=UTF-8&amp;amp;socketTimeout=300000" /&gt;
  </code></pre>
  
  <p>And following MySQL parameters:</p>
  
  <pre><code>max_connections = 100000
  wait_timeout = 31536000
  interactive_timeout = 31536000
  </code></pre>
  
  <p>I would expect there to be at least 50 idle connections in connection pool at all time.</p>
  
  <p>But what really happens is: there are 50 connections when the server started, after a while, all the connections die except the last one.</p>
  
  <p>Is there a mistake in my configuration?</p>
  
  <p>Environment:</p>
  
  <ul>
  <li>Linux 3.4 64-bit</li>
  <li>OpenJDK 7</li>
  <li>Tomcat 7</li>
  <li>MySQL 5.5</li>
  </ul>