I want to set common timeout variables in JDBC/Hikari pool.
To do this, I tried variables in JDBC URL and in Hikari config, but none seems to work.
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setJdbcUrl("jdbc:mysql://*/*?wait_timeout=77&interactive_timeout=78");
hikariConfig.setUsername("*");
hikariConfig.setPassword("*");
hikariConfig.setConnectionTimeout(65 * 1000);
hikariConfig.setIdleTimeout(66 * 1000);
HikariDataSource hikariDataSource = new HikariDataSource(hikariConfig);
Connection connection1 = hikariDataSource.getConnection();
Statement statement1 = connection1.createStatement();
ResultSet resultSet1 = null;
resultSet1 = statement1.executeQuery("show variables like '%timeout%'");
Still getting default values here
while (resultSet1.next()) {
System.out.println(resultSet1.getString(1) + " " + resultSet1.getString(2));
}
got it, we can set datasource properties via
hikariConfig.addDataSourceProperty()