Skip to content

Commit

Permalink
Merge pull request ClickHouse#2113 from larshelge/java-client-timeout
Browse files Browse the repository at this point in the history
docs: add socket and connection timeout options to JDBC large insert
  • Loading branch information
mzitnik authored Mar 7, 2024
2 parents 4e5f921 + 41847e4 commit 290be49
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/en/integrations/language-clients/java/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,21 @@ For a detailed guide, go to [Configuring HTTP library](/docs/en/integrations/jav
Alternatively, you can add equivalent parameters to the JDBC URL.
The default socket and connection timeout for the JDBC driver is 30 seconds. The timeout can be increased to support large data insert operations. Use the `options` method on `ClickHouseClient` together with the `SOCKET_TIMEOUT` and `CONNECTION_TIMEOUT` options as defined by `ClickHouseClientOption`:
```java
final int MS_12H = 12 * 60 * 60 * 1000; // 12 h in ms
final String sql = "insert into table_a (c1, c2, c3) select c1, c2, c3 from table_b;";
try (ClickHouseClient client = ClickHouseClient.newInstance(ClickHouseProtocol.HTTP)) {
client.read(servers).write()
.option(ClickHouseClientOption.SOCKET_TIMEOUT, MS_12H)
.option(ClickHouseClientOption.CONNECTION_TIMEOUT, MS_12H)
.query(sql)
.executeAndWait();
}
```
#### Configuring node discovery, load balancing, and failover
##### Node discovery
Expand Down

0 comments on commit 290be49

Please sign in to comment.