Skip to content

Commit 65768de

Browse files
authored
Merge pull request #3071 from ClickHouse/update-jdbc-docs
Update JDBC docs for V2
2 parents 3d127f3 + 5f33e67 commit 65768de

File tree

6 files changed

+273
-46
lines changed

6 files changed

+273
-46
lines changed

docs/en/integrations/language-clients/java/client-v1.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
---
2-
sidebar_label: Client V1
3-
sidebar_position: 3
4-
keywords: [clickhouse, java, client, integrate]
5-
description: Java ClickHouse Connector v1
6-
slug: /en/integrations/java/client-v1
7-
---
8-
91
import Tabs from '@theme/Tabs';
102
import TabItem from '@theme/TabItem';
113
import CodeBlock from '@theme/CodeBlock';

docs/en/integrations/language-clients/java/client-v2.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
sidebar_label: Client V2
2+
sidebar_label: Client 0.8+
33
sidebar_position: 2
44
keywords: [clickhouse, java, client, integrate]
5-
description: Java ClickHouse Connector v2
5+
description: Java ClickHouse Connector 0.8+
66
slug: /en/integrations/java/client-v2
77
---
88

@@ -12,7 +12,12 @@ import CodeBlock from '@theme/CodeBlock';
1212

1313
# Java Client (V2)
1414

15-
Java client library to communicate with a DB server through its protocols. The current implementation only supports the [HTTP interface](/docs/en/interfaces/http). The library provides its own API to send requests to a server. The library also provides tools to work with different binary data formats (RowBinary* & Native*).
15+
Java client library to communicate with a DB server through its protocols. The current implementation only supports the [HTTP interface](/docs/en/interfaces/http).
16+
The library provides its own API to send requests to a server. The library also provides tools to work with different binary data formats (RowBinary* & Native*).
17+
18+
:::note
19+
If you're looking for a prior version of the java client docs, please see [here](/docs/en/integrations/language-clients/java/client-v1.md).
20+
:::
1621

1722
## Setup
1823

docs/en/integrations/language-clients/java/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ import CodeBlock from '@theme/CodeBlock';
1111

1212
# Java Clients Overview
1313

14-
- [Client-V2](./client-v2.md)
15-
- [Client-V1 (Old)](./client-v1.md)
16-
- [JDBC Driver](./jdbc-driver.md)
14+
- [Client 0.8+](./client-v2.md)
15+
- [JDBC 0.8+](./jdbc-v2.md)
1716
- [R2DBC Driver](./r2dbc.md)
1817

1918
## ClickHouse Client

docs/en/integrations/language-clients/java/jdbc-driver.md renamed to docs/en/integrations/language-clients/java/jdbc-v1.md

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
---
2-
sidebar_label: JDBC Driver
3-
sidebar_position: 4
4-
keywords: [clickhouse, java, jdbc, driver, integrate]
5-
description: ClickHouse JDBC driver
6-
slug: /en/integrations/java/jdbc-driver
7-
---
8-
91
import Tabs from '@theme/Tabs';
102
import TabItem from '@theme/TabItem';
113
import CodeBlock from '@theme/CodeBlock';
@@ -16,7 +8,7 @@ import CodeBlock from '@theme/CodeBlock';
168
`clickhouse-jdbc` implements the standard JDBC interface. Being built on top of [clickhouse-client](/docs/en/integrations/sql-clients/sql-console), it provides additional features like custom type mapping, transaction support, and standard synchronous `UPDATE` and `DELETE` statements, etc., so that it can be easily used with legacy applications and tools.
179

1810
:::note
19-
Latest JDBC (0.7.2) version uses Client-V1
11+
Latest JDBC (0.7.2) version uses Client-V1
2012
:::
2113

2214
`clickhouse-jdbc` API is synchronous, and generally, it has more overheads(e.g., SQL parsing and type mapping/conversion, etc.). Consider [clickhouse-client](/docs/en/integrations/sql-clients/sql-console) when performance is critical or if you prefer a more direct way to access ClickHouse.
@@ -121,14 +113,14 @@ Note: please refer to [JDBC specific configuration](https://github.com/ClickHous
121113

122114
## Supported data types
123115

124-
JDBC Driver supports same data formats as client library does.
116+
JDBC Driver supports same data formats as client library does.
125117

126118
:::note
127119
- AggregatedFunction - :warning: does not support `SELECT * FROM table ...`
128120
- Decimal - `SET output_format_decimal_trailing_zeros=1` in 21.9+ for consistency
129121
- Enum - can be treated as both string and integer
130-
- UInt64 - mapped to `long` (in client-v1)
131-
:::
122+
- UInt64 - mapped to `long` (in client-v1)
123+
:::
132124

133125
## Creating Connection
134126

@@ -160,7 +152,7 @@ try (Connection conn = dataSource.getConnection(...);
160152

161153
:::note
162154
- Use `PreparedStatement` instead of `Statement`
163-
:::
155+
:::
164156

165157
It's easier to use but slower performance compare to input function (see below):
166158

@@ -194,7 +186,7 @@ try (PreparedStatement ps = conn.prepareStatement(
194186

195187
### Insert with placeholders
196188

197-
This option is recommended only for small inserts because it would require a long SQL expression (that will be parsed on client side and it will consume CPU & Memory):
189+
This option is recommended only for small inserts because it would require a long SQL expression (that will be parsed on client side and it will consume CPU & Memory):
198190

199191
```java showLineNumbers
200192
try (PreparedStatement ps = conn.prepareStatement("insert into mytable values(trim(?),?,?)")) {
@@ -272,10 +264,10 @@ try (PreparedStatement stmt = conn.prepareStatement(
272264

273265
## Configuring HTTP library
274266

275-
The ClickHouse JDBC connector supports three HTTP libraries: [HttpClient](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html), [HttpURLConnection](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/HttpURLConnection.html), and [Apache HttpClient](https://hc.apache.org/httpcomponents-client-5.2.x/).
267+
The ClickHouse JDBC connector supports three HTTP libraries: [`HttpClient`](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html), [`HttpURLConnection`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/HttpURLConnection.html), and [Apache `HttpClient`](https://hc.apache.org/httpcomponents-client-5.2.x/).
276268

277269
:::note
278-
HttpClient is only supported in JDK 11 or above.
270+
`HttpClient` is only supported in JDK 11 or above.
279271
:::
280272

281273
The JDBC driver uses `HttpClient` by default. You can change the HTTP library used by the ClickHouse JDBC connector by setting the following property:
@@ -286,11 +278,11 @@ properties.setProperty("http_connection_provider", "APACHE_HTTP_CLIENT");
286278

287279
Here is a full list of the corresponding values:
288280

289-
| Property Value | HTTP Library |
290-
| ------------------- | ----------------- |
291-
| HTTP_CLIENT | HttpClient |
292-
| HTTP_URL_CONNECTION | HttpURLConnection |
293-
| APACHE_HTTP_CLIENT | Apache HttpClient |
281+
| Property Value | HTTP Library |
282+
|---------------------|---------------------|
283+
| HTTP_CLIENT | `HttpClient` |
284+
| HTTP_URL_CONNECTION | `HttpURLConnection` |
285+
| APACHE_HTTP_CLIENT | Apache `HttpClient` |
294286

295287
<br/>
296288

@@ -300,16 +292,16 @@ To establish a secure JDBC connection to ClickHouse using SSL, you need to confi
300292

301293
## SSL Properties
302294

303-
| Name | Default Value | Optional Values | Description |
304-
| ------------------ | ------------- | --------------- | ---------------------------------------------------------------------------- |
305-
| `ssl` | false | true, false | Whether to enable SSL/TLS for the connection |
306-
| `sslmode` | strict | strict, none | Whether to verify SSL/TLS certificate |
307-
| `sslrootcert` | | | Path to SSL/TLS root certificates |
308-
| `sslcert` | | | Path to SSL/TLS certificate |
309-
| `sslkey` | | | RSA key in PKCS#8 format |
310-
| `key_store_type` | | JKS, PKCS12 | Specifies the type or format of the KeyStore/Truststore file |
311-
| `trust_store` | | | Path to the Truststore file |
312-
| `key_store_password` | | | Password needed to access the KeyStore file specified in the KeyStore config |
295+
| Name | Default Value | Optional Values | Description |
296+
| ------------------ | ------------- | --------------- |----------------------------------------------------------------------------------|
297+
| `ssl` | false | true, false | Whether to enable SSL/TLS for the connection |
298+
| `sslmode` | strict | strict, none | Whether to verify SSL/TLS certificate |
299+
| `sslrootcert` | | | Path to SSL/TLS root certificates |
300+
| `sslcert` | | | Path to SSL/TLS certificate |
301+
| `sslkey` | | | RSA key in PKCS#8 format |
302+
| `key_store_type` | | JKS, PKCS12 | Specifies the type or format of the `KeyStore`/`TrustStore` file |
303+
| `trust_store` | | | Path to the `TrustStore` file |
304+
| `key_store_password` | | | Password needed to access the `KeyStore` file specified in the `KeyStore` config |
313305

314306
These properties ensure that your Java application communicates with the ClickHouse server over an encrypted connection, enhancing data security during transmission.
315307

0 commit comments

Comments
 (0)