Open mshustov opened 1 year ago
from @mzitnik https://github.com/ClickHouse/ClickHouse/discussions/56127#discussioncomment-7433272
In JDBC driver .getConnection
is generating an under the hood a single connection to the DB the heavy lifting of the connection pool is done outside the diver, by using. Hikari externally solves the concurrency issue.
HikariConfig configuration = new HikariConfig();
configuration.setMaximumPoolSize(1);
configuration.setJdbcUrl("jdbc:ch:{hostname}:{port}/default?insert_quorum=auto&server_time_zone&server_version=22.13.1.24495");
configuration.setUsername(username);
configuration.setPassword(password);
configuration.setValidationTimeout(6000000);
HikariDataSource ds = new HikariDataSource(configuration);
Use Connection conn = ds.getConnection();
to get connection and you get it from hikari pool
I will provide a sample with full mvn example for using
hi @mzitnik and @mshustov thanks for your response. by the way, I can integrate hikari by myself. but , I also hope the community can provide a best practice example.
@mshustov Checked the code today and found an example how to use it just making sure that we want it in the ClickHouse docs is it correct.
@Young0516 is the example above is good enough.
@mzitnik thanks
@mzitnik let's add it to the docs
add an example of usage with Hikari