title: Connection close does not close the connections in Tomcat
body: <p>In my java web project which runs on Tomcat there are over 4000 sleeping connections after 2 day (I checked them with sp_who command). I do close every statement, resultset and connections after I do a database job. I use the below template for database stuffs.</p>
  
  <pre><code>    try{
          this.openConnection();
          this.createStatement();
  
          // things ...
  
          this.cleanResources();
      }catch (SQLException e){
          this.cleanResources();
          e.printStackTrace();
      }
  
      public void cleanResources() {
      try {
          if (this.rs != null) {
              rs.close();
              this.rs = null;
          }
          if (this.stmt != null) {
              stmt.close();
              this.stmt = null;
          }
          if (this.conn != null) this.closeConnection();
      } catch (Exception e) {
          e.printStackTrace();
      } finally {
          if (this.conn != null) this.closeConnection();
      }
  }
  
     public void closeConnection() {
      try {
          if (this.conn != null)
              this.conn.close();
          this.isOpen = false;
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  
  public void createStatement() {
      try {
          if (!this.isOpen) this.openConnection();
          this.stmt = this.conn.createStatement();
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  
  public void openConnection() {
      try {
          this.conn = ds.getConnection(); // ds is a javax.sql.DataSource instance
          this.isOpen = true;
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>After every time a sql code worked, the row counts which has sleeping status does increases and the database stuffs gets so much slower. Why does it happens? How can I completely kill a connection after I done with it? Is it really the sleeping connections that makes slower my SQL Server?</p>
  
  <p>Here is my Tomcat configurations(In context.xml):</p>
  
  <pre><code>maxTotal="20" maxActive="20" maxIdle="20"
  </code></pre>