title: Tomcat8 + c3p0, connections are being interruped and auto closed
body: <p>I'm developing a web app on Tomcat 8 with Maven, I'm using c3p0 to handle connections on the main thread and on 2 other concurrent threads, my connection manager class is asking a DataSource singleton class I've implemented for synchronized connections, like so</p>
  
  <pre><code>public synchronized Connection getConnection() {
      try {
          return cpds.getConnection();
      } catch (SQLException ex) {
          logger.error("Error while issuing a pooled connection", ex);
      }
      return null;
  }
  </code></pre>
  
  <p>, but when I'm trying to use these connections they start to either interrupt  </p>
  
  <pre><code>09:47:17.164 [QuartzScheduler_Worker-4] ERROR com.myapp.providers.DataSource - Error while issuing a pooled connection
  java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException
      at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) ~[c3p0-0.9.1.2.jar:0.9.1.2]
      at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65) ~[c3p0-0.9.1.2.jar:0.9.1.2]
      at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:62) ~[c3p0-0.9.1.2.jar:0.9.1.2]
      at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:531) ~[c3p0-0.9.1.2.jar:0.9.1.2]
      at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) ~[c3p0-0.9.1.2.jar:0.9.1.2]
  </code></pre>
  
  <p>or close in mid transaction and breaking any statements and result sets that are being used at that time</p>
  
  <p>I'm configuring the DataSource object like so</p>
  
  <pre><code>cpds = new ComboPooledDataSource();
          cpds.setDriverClass(oracle.jdbc.driver.OracleDriver);
          cpds.setJdbcUrl(jdbc:oracle:thin:@xx.xxx.xxx.xxx:1521:XE);
          cpds.setUser("username");
          cpds.setPassword("password");
  
          // database connection properties
          cpds.setInitialPoolSize(10);
          cpds.setAcquireIncrement(3);
          cpds.setMaxPoolSize(100);
          cpds.setMinPoolSize(15);
          cpds.setMaxStatements(75);
  
          // connection pool preferences
          cpds.setIdleConnectionTestPeriod(60);
          cpds.setMaxIdleTime(30000);
          cpds.setAutoCommitOnClose(false);
          cpds.setPreferredTestQuery("SELECT 1 FROM DUAL");
          cpds.setTestConnectionOnCheckin(false);
          cpds.setTestConnectionOnCheckout(false);
          cpds.setAcquireRetryAttempts(30);
          cpds.setAcquireRetryDelay(1000);
          cpds.setBreakAfterAcquireFailure(false);
  </code></pre>
  
  <p>I've also written a small test method that runs in a loop and queries the database for n times but that works fine.</p>