Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote connectivity issue #7

Closed
Ngalstyan4 opened this issue Jul 25, 2016 · 8 comments
Closed

Remote connectivity issue #7

Ngalstyan4 opened this issue Jul 25, 2016 · 8 comments

Comments

@Ngalstyan4
Copy link

new ClickHouseDataSource("jdbc:clickhouse://clickhouse:8123").getConnection().createStatement();
When trying to connect like this, I get the following error

Exception in thread "main" ru.yandex.clickhouse.except.ClickHouseException: ClickHouse exception, code: 210, host: clickhouse, port: 8123; Connect to clickhouse:8123 [clickhouse/40.78.***.***] failed: connect timed out at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:42) at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:23) at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:461) at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:73) at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ru.yandex.clickhouse.util.LogProxy.invoke(LogProxy.java:42) at com.sun.proxy.$Proxy3.executeQuery(Unknown Source) at am.galstyan.ClickhouseJdbc.main(ClickhouseJdbc.java:17) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

It seems that connection works fine only if the host is local otherwise it throws this exception

even when I am trying to connect, say, fb.com, it throws the very same exception, however when I am trying to connect to localhost, it works fine.
COuld you help me resolve the issue

@rasmus93
Copy link
Contributor

We have database in our local network and everything is fine when we try to connect to it within it network. But when we try to connect to database from another network we have the same error as described above.
I try to connect by http interface from both networks and everything is ok.
It seems that there is some bug in jdbc driver.
Can you help us, please?

@serebrserg
Copy link
Contributor

There must not be any difference for the driver in connecting to local or remote network.
I think the problem may be in the network latency. The predefined connection timeout is 50ms (see /~https://github.com/yandex/clickhouse-jdbc/blob/master/src/main/java/ru/yandex/clickhouse/settings/ClickHouseConnectionSettings.java).
You can override this setting by passing an instance of ClickHouseProperties with overridden defaults to your ClickHouseDataSource constructor or to ClickHouseDriver.connect().
You also can pass Properties object with appropriate value for key "connection_timeout".
Please comment whether this helps.

@rasmus93
Copy link
Contributor

Setting value for key "connection_timeout" helped. Thanks!

@bhagujava
Copy link

I have set connection_timeout property but getting same issue. Please help us.

@rasmus93
Copy link
Contributor

@bhagujava do you use the last version of jdbc-driver?

@bhagujava
Copy link

bhagujava commented Nov 4, 2017

@rasmus93 After updating last version its working now.

@mspisarev
Copy link

mspisarev commented Oct 3, 2019

in data grip throws java.net.ConnectException when trying to connect to clickhouse al virtual machine at jdbc:clickhouse://192.168.15.110:8123

java.net.ConnectException: Connection refused: connect.

please help

@mspisarev
Copy link

in data grip throws java.net.ConnectException when trying to connect to clickhouse al virtual machine at jdbc:clickhouse://192.168.15.110:8123

java.net.ConnectException: Connection refused: connect.

please help

ОК. I got it - at file /etc/clickhouse-server/config.xml uncomment line
<listen_host>::</listen_host>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants