title: How to fix java.sql.SQLException: isValid() returned false
body: <p>I get the problem about pool connection.
  A build ap AIP on server. If it's long time no request sent to my app (about <code>2h</code>), I send a new request my app. I get the problem like this:</p>
  
  <pre><code>DEBUG o.a.c.d.PoolableConnectionFactory - Failed to validate a poolable connection.
  java.sql.SQLException: isValid() returned false
      at org.apache.commons.dbcp2.PoolableConnection.validate(PoolableConnection.java:283)
      at org.apache.commons.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:362)
      at org.apache.commons.dbcp2.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:347).
  </code></pre>
  
  <p>I had fix this problem as <a href="https://stackoverflow.com/questions/43521746/error-cannot-create-poolableconnectionfactory-isvalid-returned-false?newreg=5dd2314396474c4cac5d8fcff46268d2">ERROR: Cannot create PoolableConnectionFactory (isValid() returned false)</a>. But not done.</p>
  
  <p>My properties config:</p>
  
  <pre><code>spring.datasource.dbcp2.initial-size=7
  spring.datasource.dbcp2.max-total=20
  spring.datasource.dbcp2.pool-prepared-statements=true
  spring.datasource.test-while-idle = true
  spring.datasource.test-on-borrow=true
  spring.datasource.validation-query = SELECT 1
  spring.datasource.time-between-eviction-runs-millis = 60000
  spring.datasource.hikari.connectionTimeout=30000
  spring.datasource.hikari.idleTimeout=60000
  spring.datasource.hikari.maxLifetime=180000
  </code></pre>
  
  <p>Please help me.</p>