title: Hikari cp with spring boot.. Active connections always at 1.. Not increasing but not comig down to 0
body: <p>I am connecting to a db2 database using springBoot application.</p>
  <p>I am using SpringBoot 2.1.2 Release.
  db2jcc4 version is 4.26.14
  At the server startup the database connection is established.</p>
  <pre><code>@ConfigurationProperties(prefix=&quot;data.app&quot;)
  @Bean
  public DataSource dataSourceApp(){
  
  return new HikariDataSource(new HikariConfig())
  }
  
  @Bean
  EntityManagerFactory appEntityManagerFactory(){
  LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean ();
  emf.setDataSource(dataSourceApp);
  emf.setJPAVendorAdaptor(jpaVendorAdaptor);
  emf.afterPropertiesSet();
  return emf.getObject();
  
  }
  
  
  @Bean
  publc EntityManager appEntityManager()
  {
  return appEntityManagerFactory.createEntityManager();
  }
  </code></pre>
  <p>Then this entityManager is used for executing queries for each request.</p>
  <p>Following are the connection pool properties</p>
  <pre><code>data.app.minimumIdle=0
  data.app.idleTimeout=120000
  data.app.driverClassName=com.ibm.db2.jcc.DB2Driver
  data.app.jdbcURL=
  data.app.username=
  data.app.password=
  data.app.maximumPoolSize=10
  data.app.connectionTimeout=300000
  data.app.poolName=
  data.app.maxLifetime=130000
  data.app.validationTimeout=300000
  </code></pre>
  <p>When the request comes</p>
  <pre><code>@Autowired
  Entitymanager entityManager;
  
  Query query= entitymanager. CreateNativeQuery(queryString) ;
  
  ExecuteQueries(query, queryString) 
  </code></pre>
  <p>When the application  is first started the active Connections are shown as 0(have enabled Hikari monitoring)
  On execution of 1stquery the active connections grow to 1 and remain at 1 even if multiple queries are fired. And even after the idleTimeout and maxlifetime have reached. How do I return back this connection to pool. I have tried using entitymanager.
  Close() in the finally block.. But this is also not returning the connection to pool.
  Any help is appreciated. Thanks.</p>
  <p>Thanks in advance .</p>