HikariCP: What database level timeouts should be considered to set maxLifetime for Oracle 11g

Short answer: none (by default). For the record (to include details here in case the link changes), we’re talking about property maxLifetime of HikariCP: This property controls the maximum lifetime of a connection in the pool. An in-use connection will never be retired, only when it is closed will it then be removed. We strongly … Read more

How to set up datasource with Spring for HikariCP?

you need to write this structure on your bean configuration (this is your datasource): <bean id=”hikariConfig” class=”com.zaxxer.hikari.HikariConfig”> <property name=”poolName” value=”springHikariCP” /> <property name=”connectionTestQuery” value=”SELECT 1″ /> <property name=”dataSourceClassName” value=”${hibernate.dataSourceClassName}” /> <property name=”maximumPoolSize” value=”${hibernate.hikari.maximumPoolSize}” /> <property name=”idleTimeout” value=”${hibernate.hikari.idleTimeout}” /> <property name=”dataSourceProperties”> <props> <prop key=”url”>${dataSource.url}</prop> <prop key=”user”>${dataSource.username}</prop> <prop key=”password”>${dataSource.password}</prop> </props> </property> </bean> <!– HikariCP configuration –> <bean … Read more

How do I configure HikariCP in my Spring Boot app in my application.properties files?

@Configuration @ConfigurationProperties(prefix = “params.datasource”) public class JpaConfig extends HikariConfig { @Bean public DataSource dataSource() throws SQLException { return new HikariDataSource(this); } } application.yml params: datasource: driverClassName: com.mysql.jdbc.Driver jdbcUrl: jdbc:mysql://localhost:3306/myDb username: login password: password maximumPoolSize: 5 UPDATED! Since version Spring Boot 1.3.0 : Just add HikariCP to dependencies Configure application.yml application.yml spring: datasource: type: com.zaxxer.hikari.HikariDataSource url: … Read more