Cannot connect with clickhouse jdbc driver

4,453 views
Skip to first unread message

Ivan Kosyanenko

unread,
Mar 2, 2017, 12:06:29 PM3/2/17
to ClickHouse
Не могу подконнектится с jdbc драйвером. Может неправильно логин/пароль? хотя дефолтные вроде

ClickHouseConnection conn = new ClickHouseDriver().connect("jdbc:clickhouse://localhost:9000", new ClickHouseProperties().withCredentials("default", null));

ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: localhost, port: 9000; error while read response Magic is not correct: 32
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.getException(ClickHouseExceptionSpecifier.java:86)
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:55)
at ru.yandex.clickhouse.except.ClickHouseExceptionSpecifier.specify(ClickHouseExceptionSpecifier.java:28)
at ru.yandex.clickhouse.ClickHouseStatementImpl.getInputStream(ClickHouseStatementImpl.java:506)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:96)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:80)
at ru.yandex.clickhouse.ClickHouseStatementImpl.executeQuery(ClickHouseStatementImpl.java:76)
at ru.yandex.clickhouse.ClickHouseStatementImpl.execute(ClickHouseStatementImpl.java:161)
at com.test.App.main(App.java:20)
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:147)

Alex Zatelepin

unread,
Mar 2, 2017, 12:13:40 PM3/2/17
to ClickHouse
Коннектиться надо к порту HTTP-интерфейса (по дефолту это 8123). Порт 9000 для нативного клиента.

Igor Polevoy

unread,
Aug 9, 2017, 6:09:23 PM8/9/17
to ClickHouse
I have a similar issue: 

ru.yandex.clickhouse.except.ClickHouseUnknownException: ClickHouse exception, code: 1002, host: ip6-localhost, port: 8123; error while read response Magic is not correct: 112

My installation is default, and the port is 8123, as you can see. Any ideas? 

7615...@qq.com

unread,
Aug 9, 2017, 9:41:43 PM8/9/17
to ClickHouse
clickhouse jdbc use http, so the port is 8123

在 2017年3月3日星期五 UTC+8上午1:06:29,Ivan Kosyanenko写道:

Igor Polevoy

unread,
Aug 9, 2017, 10:20:44 PM8/9/17
to ClickHouse
this is the port I'm using

James Wang

unread,
Aug 10, 2017, 4:55:18 AM8/10/17
to ClickHouse
Check firewall settings.

Ensure ClickHouse listen on both 127.0.0.1 and external IP (so you can connect from another server).


Igor Polevoy

unread,
Aug 10, 2017, 4:01:40 PM8/10/17
to ClickHouse
I found the issue. Apt-get upgrade whiped out my password from the users.xml file. Once the password was restored, all came back to normal. The error message could be better though, as it sent me on a wild goose chase!
Reply all
Reply to author
Forward
0 new messages