Skip to content

Connection string

Oleg V. Kozlyuk edited this page Mar 7, 2023 · 23 revisions
Parameter name Description Value if omitted
Database Initial database for connection default
Username Authentication username default
Password Authentication password
Host ClickHouse server address localhost
Port ClickHouse server port 8123 or 8443 (depending on Protocol and library version)
Driver Deprecated since version 2.0 Binary
Compression Enables GZip compression of data true from version 2.0, false earlier
UseSession Enables use of server sessions false
SessionId Explicitly set session ID (string) random GUID
Timeout Sets HTTP timeout duration 120
Protocol Sets protocol used (HTTP or HTTPS) http
UseServerTimezone Use server timezone for datetime columns without TZ spec true in 6.0.0+, false before that
UseCustomDecimals Use ClickHouseDecimal class for decimal values false

Example: Host=clickhouse;Port=8123;Username=default;password=;Database=default

Note: sessions

UseSession flag enables persistence of server session, allowing use of SET statements and temp tables. Session will be reset after 60 seconds of inactivity (default timeout). Session life0time can be extended by setting session settings via ClickHouse statements

ClickHouseConnection class normally allows for parallel operation (multiple threads can run queries concurrently). However, enabling UseSession flag will limit that to one active query per connection at any moment of time (serverside limitation)