Help Center/ GaussDB(for MySQL)/ FAQs/ Database Connections/ How Do I Enable Availability Detection for a Connection Pool in the Service Code?
Updated on 2024-09-05 GMT+08:00

How Do I Enable Availability Detection for a Connection Pool in the Service Code?

To ensure that your application obtains an available connection from a connection pool, you need to configure how the connection pool will check connection availability.

  • For a JDBC or Druid connection pool:

    Set testOnBorrow to true.

  • For a HikariCP connection pool:

    Set connectionTestQuery to "SELECT 1".