title: Tomcat JDBC Exception PoolExhausted
body: <p>I am getting always the same exception , i have tried my best by doing searches to get the solution but without benefit.</p>
  
  <p>My exception is:</p>
  
  <pre><code>SEVERE: Exception : org.apache.tomcat.jdbc.pool.PoolExhaustedException: [pool-2-thread-1] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:100; busy:100; idle:0; lastwait:30000].
      at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:672)
      at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:187)
      at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)
      at com.xxxxx.dbmanager.utils.DBManager.getConnection(DBManager.java:81)
      at com.xxxxx.dbmanager.utils.SQLManager.&lt;init&gt;(SQLManager.java:36)
      at ...
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  </code></pre>
  
  <p>I have tried to increase the maximum number of connections in mysql DB.</p>
  
  <p>I am just wondering if a servlet running in the background and creating threads could be the problem? And how can i kill my threads when tasks are done ?</p>
  
  <p>Appreciating your help !!</p>