Clickhouse: HttpClient cannot use 'USE' query

Created on 2 Mar 2019  Â·  2Comments  Â·  Source: ClickHouse/ClickHouse

why and how to resolve it at below photo?
image

comp-http question

Most helpful comment

HTTP by default is stateless, to remeber states between different requests you need to use session.

Similarly, you can use ClickHouse sessions in the HTTP protocol. To do this, you need to add the session_id GET parameter to the request. You can use any string as the session ID. By default, the session is terminated after 60 seconds of inactivity. To change this timeout, modify the default_session_timeout setting in the server configuration, or add the session_timeout GET parameter to the request. To check the session status, use the session_check=1 parameter. Only one query at a time can be executed within a single session.

(From https://clickhouse.yandex/docs/en/interfaces/http/ ).

As an alternative you can just pass needed database into database GET parameter. Just like that:
GET 'http://localhost:8123/?database=monitor'

All 2 comments

HTTP by default is stateless, to remeber states between different requests you need to use session.

Similarly, you can use ClickHouse sessions in the HTTP protocol. To do this, you need to add the session_id GET parameter to the request. You can use any string as the session ID. By default, the session is terminated after 60 seconds of inactivity. To change this timeout, modify the default_session_timeout setting in the server configuration, or add the session_timeout GET parameter to the request. To check the session status, use the session_check=1 parameter. Only one query at a time can be executed within a single session.

(From https://clickhouse.yandex/docs/en/interfaces/http/ ).

As an alternative you can just pass needed database into database GET parameter. Just like that:
GET 'http://localhost:8123/?database=monitor'

@filimonov thanks

Was this page helpful?
0 / 5 - 0 ratings