diff --git a/docs/en/integrations/language-clients/java/index.md b/docs/en/integrations/language-clients/java/index.md index 5eb164967b1..beeda0926dd 100644 --- a/docs/en/integrations/language-clients/java/index.md +++ b/docs/en/integrations/language-clients/java/index.md @@ -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