You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Java client and JDBC driver for ClickHouse. Java client is async and light weight library for accessing ClickHouse in Java; while JDBC driver is built on top of the Java client with more dependencies and extensions for JDBC-compliance.
6
6
7
7
## Usage
8
8
9
9
### Java Client
10
10
11
-
Use Java client when you prefer async and more "direct" way to communicate with ClickHouse. JDBC driver is actually a thin wrapper of the Java client.
12
-
13
11
```xml
14
12
<dependency>
15
13
<groupId>com.clickhouse</groupId>
16
-
<!--you'll be able to use clickhouse-http-client and clickhouse-tcp-client as well in the near future-->
17
-
<artifactId>clickhouse-grpc-client</artifactId>
14
+
<!--or clickhouse-grpc-client if you prefer gRPC-->
15
+
<artifactId>clickhouse-http-client</artifactId>
18
16
<version>0.3.2</version>
19
17
</dependency>
20
18
```
21
19
22
-
Example:
23
-
24
-
```Java
25
-
// declare a server to connect to
26
-
ClickHouseNode server =ClickHouseNode.of("server.domain", ClickHouseProtocol.GRPC, 9100, "my_db");
27
-
28
-
// run multiple queries in one go and wait until it's finished
29
-
ClickHouseClient.send(server,
30
-
"create database if not exists test",
31
-
"use test", // change current database from my_db to test
32
-
"create table if not exists test_table(s String) engine=Memory",
<!--groupId and package name will be changed to com.clickhouse starting from 0.4.0 -->
69
-
<groupId>ru.yandex.clickhouse</groupId>
68
+
<!--ru.yandex.clickhouse will be retired starting from 0.4.0 -->
69
+
<groupId>com.clickhouse</groupId>
70
70
<artifactId>clickhouse-jdbc</artifactId>
71
71
<version>0.3.2</version>
72
+
<!-- below is only needed when all you want is a shaded jar -->
73
+
<classifier>http</classifier>
74
+
<exclusions>
75
+
<exclusion>
76
+
<groupId>*</groupId>
77
+
<artifactId>*</artifactId>
78
+
</exclusion>
79
+
</exclusions>
72
80
</dependency>
73
81
```
74
82
75
-
URL syntax: `jdbc:clickhouse://<host>:<port>[/<database>[?param1=value1¶m2=value2]]`, e.g. `jdbc:clickhouse://localhost:8123/test?socket_timeout=120000`
0 commit comments