ClickHouse/clickhouse-java

problem with JDBC Driver Connection Reset

heyucheng99 opened this issue · 5 comments

Clickhouse version 22.8.8.3

This error occurs when I replace ru.yandex.clickhouse:clickhouse-jdbc:0.2.6 with com.clickhouse:clickhouse-jdbc:0.4.6. I found that ClickHouse can only establish a connection using versions of ru.yandex.clickhouse:clickhouse-jdbc that are older than 0.2.6.
How can this issue be resolved?

errors Log:
java.sql.SQLException: Connection reset, server ClickHouseNode(addr=http:node1:18123, db=pm2)@-1610213718
at com.clickhouse.jdbc.SqlExceptionUtils.handle(SqlExceptionUtils.java:54) ~[clickhouse-jdbc-0.3.2.jar:clickhouse-jdbc 0.3.2 (revision: 1795272)]
at com.clickhouse.jdbc.SqlExceptionUtils.handle(SqlExceptionUtils.java:69) ~[clickhouse-jdbc-0.3.2.jar:clickhouse-jdbc 0.3.2 (revision: 1795272)]
at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.(ClickHouseConnectionImpl.java:226) ~[clickhouse-jdbc-0.3.2.jar:clickhouse-jdbc 0.3.2 (revision: 1795272)]
at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.(ClickHouseConnectionImpl.java:168) ~[clickhouse-jdbc-0.3.2.jar:clickhouse-jdbc 0.3.2 (revision: 1795272)]
at com.clickhouse.jdbc.ClickHouseDriver.connect(ClickHouseDriver.java:145) ~[clickhouse-jdbc-0.3.2.jar:clickhouse-jdbc 0.3.2 (revision: 1795272)]
at com.clickhouse.jdbc.ClickHouseDriver.connect(ClickHouseDriver.java:41) ~[clickhouse-jdbc-0.3.2.jar:clickhouse-jdbc 0.3.2 (revision: 1795272)]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477) [HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560) [HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115) [HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:81) [HikariCP-3.4.5.jar:na]
at com.baomidou.dynamic.datasource.creator.HikariDataSourceCreator.doCreateDataSource(HikariDataSourceCreator.java:93) [dynamic-datasource-spring-boot-starter-3.4.1.jar:3.4.1]
at com.baomidou.dynamic.datasource.creator.AbstractDataSourceCreator.createDataSource(AbstractDataSourceCreator.java:54) [dynamic-datasource-spring-boot-starter-3.4.1.jar:3.4.1]
at com.baomidou.dynamic.datasource.creator.DefaultDataSourceCreator.createDataSource(DefaultDataSourceCreator.java:48) [dynamic-datasource-spring-boot-starter-3.4.1.jar:3.4.1]
at com.baomidou.dynamic.datasource.provider.AbstractDataSourceProvider.createDataSourceMap(AbstractDataSourceProvider.java:45) [dynamic-datasource-spring-boot-starter-3.4.1.jar:3.4.1]
at com.baomidou.dynamic.datasource.provider.YmlDynamicDataSourceProvider.loadDataSources(YmlDynamicDataSourceProvider.java:42) [dynamic-datasource-spring-boot-starter-3.4.1.jar:3.4.1]
at com.baomidou.dynamic.datasource.DynamicRoutingDataSource.afterPropertiesSet(DynamicRoutingDataSource.java:240) [dynamic-datasource-spring-boot-starter-3.4.1.jar:3.4.1]

Good day, @heyucheng99!
Thank you for reporting the issue.
Have you tried the latest client 0.6.3?
What settings do you have? Would you please list it?

It would be helpful to capture the traffic using Wireshark or tcp dump - it should show if client sent any data.

Thank you!

I tried using the latest JDBC driver (version 0.6.3) to connect to the ClickHouse database, but the connection failed. I didn't change any of the basic JDBC settings. Even when I tried using the same JDBC driver with DBeaver, the connection still couldn't be established. The version that worked for me was under 0.2.6.(ru.yandex.clickhouse)

@heyucheng99 thank you!
I've just checked that we had recent tests against 22.8 with 0.6.2 release.
It may be some environment issue.

Would you please try to run example https://github.com/ClickHouse/clickhouse-java/tree/main/examples/jdbc against your server? It will help to reduce number of suspects.

And I've just noticed Connection reset, server ClickHouseNode(addr=http:node1:18123, db=pm2) Do you have a server on non standard port or is it a typo 18123 ?

Thanks!

We redeployed the ClickHouse image on the server, which successfully resolved the issue. It was likely an environmental anomaly.

Thank you for your assistance!

@heyucheng99 yw!
Thank you for reporting back. I'll close the issue.