@@ -20,28 +20,32 @@ URL syntax:
2020JDBC Driver Class:
2121` ru.yandex.clickhouse.ClickHouseDriver `
2222
23- additionally, if you have a few instances, you can use ` BalancedClickhouseDataSource ` .
24-
25- ** Notice**
26-
27- To use an up-to-date version of RoaringBitmap, please update your POM with below two changes:
28- ``` xml
29- <!-- 1. add repository -->
30- <repositories >
31- <repository >
32- <id >jitpack.io</id >
33- <url >https://jitpack.io</url >
34- </repository >
35- </repositories >
23+ For example:
24+ ``` java
25+ String url = " jdbc:clickhouse://localhost:8123/test" ;
26+ ClickHouseProperties properties = new ClickHouseProperties ();
27+ // set connection options - see more defined in ClickHouseConnectionSettings
28+ properties. setClientName(" Agent #1" );
29+ ...
30+ // set default request options - more in ClickHouseQueryParam
31+ properties. setSessionId(" default-session-id" );
32+ ...
3633
37- <!-- 2. add dependency(groupId is different from the one in maven central) -->
38- <dependency >
39- <groupId >com.github.RoaringBitmap</groupId >
40- <artifactId >RoaringBitmap</artifactId >
41- <version >0.9.10</version >
42- </dependency >
34+ ClickHouseDataSource dataSource = new ClickHouseDataSource (url, properties)
35+ String sql = " select * from mytable" ;
36+ Map<ClickHouseQueryParam , String > additionalDBParams = new HashMap<> ();
37+ // set request options, which will override the default ones in ClickHouseProperties
38+ additionalDBParams. put(ClickHouseQueryParam . SESSION_ID , " new-session-id" );
39+ ...
40+ try (ClickHouseConnection conn = dataSource. getConnection();
41+ ClickHouseStatement stmt = conn. createStatement();
42+ ResultSet rs = stmt. executeQuery(sql, additionalDBParams)) {
43+ ...
44+ }
4345```
4446
47+ Additionally, if you have a few instances, you can use ` BalancedClickhouseDataSource ` .
48+
4549### Extended API
4650In order to provide non-JDBC complaint data manipulation functionality, proprietary API exists.
4751Entry point for API is ` ClickHouseStatement#write() ` method.
0 commit comments