title: HikariCP not closing connections on close() (Connection Leak)
body: <p>I'm using HikariCP 3.3.1 and PostgreSQL. But I've a problem with closing my connections, in Hikari config I set maximum pool size to 15 and minimum idle connection to 5, but after a few minutes of work with database I've found out connections don't closes, they stack more and more (almost 100 Idle connections right now). 
  <a href="https://i.stack.imgur.com/yCMo1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yCMo1.png" alt="enter image description here"></a></p>
  
  <p>My Connector class:</p>
  
  <p><strong><em>Connector.java</em></strong></p>
  
  <pre><code>public class Connector implements IConnector {
  private static HikariConfig config = new HikariConfig();
  private static HikariDataSource ds;
  
  static {
      config.setDriverClassName(org.postgresql.Driver.class.getName());
      config.setJdbcUrl("jdbc:postgresql://localhost:5432/vskDB");
      config.setUsername("postgres");
      config.setPassword("root");
      config.setMinimumIdle(5);
      config.setMaximumPoolSize(15);
      config.setConnectionTimeout(20000);
      config.setIdleTimeout(300000);
      ds = new HikariDataSource(config);
  }
  
  public Connection getConnection() {
      log.info("getConnection() invoked");
      try {
          return ds.getConnection();
      } catch (SQLException e) {
          log.error("Can't get connection from DataSource.");
          log.error(e.getMessage());
          System.out.println(e.getMessage());
      }
      return null;
  }
  
  Connector() {
  }
  }
  </code></pre>
  
  <p>And here's my DAO class (simplified):
  <strong><em>UserDAO.java</em></strong></p>
  
  <pre><code>public class UserDatabaseDAO implements UserDAO {
      private Connector connector = new Connector();
      private Connection dbConnection;
  
      @Override
      public void removeUser(Long id) {
          try {
              dbConnection = connector.getConnection();
              if (dbConnection == null)
                  throw new ConnectException();
  
              PreparedStatement preparedStatement = dbConnection.prepareStatement("DELETE FROM users WHERE user_id = ?");
              preparedStatement.setLong(1, id);
              preparedStatement.execute();
  
          } catch (SQLException | ConnectException e) {
              log.error("Can't remove user from database");
              log.error(e.getMessage());
              System.out.print(e.getMessage());
          } finally {
              try {
                  dbConnection.close();
              } catch (SQLException e) {
                  log.error("Can't close connection");
                  log.error(e.getMessage());
                  System.out.print(e.getMessage());
              }
          }
      }
  }
  </code></pre>
  
  <p><a href="https://github.com/brettwooldridge/HikariCP/issues/870" rel="nofollow noreferrer">Here</a> I've found an issue with some facts about Hikari:<br>
  <em>You must call close() on the connection instance that HikariCP gives you</em></p>
  
  <p>Maybe my <code>dbConnection.close()</code> wont work because it's just a copy of Connection which Hikari gives me in <code>getConnection()</code> method.</p>