You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now you can connect to ClickHouse by specifiying separately host, port, username, password and other parameters. clickhouse-client --host=... --port=... --user=... --password=...
It is already possible to specify the connection string as a URI in many databases. Example from PostgreSQL postgresql://localhost:5433/my_database
It is simple, convenient and frequently used. You can just copy the link and connect.
Describe the solution you'd like
I want to achieve next general form of the connection URL:
clickhouse://[userspec@][hostspec][/dbname][?paramspec]
where userspec is:
user[:password]
where hostspec is:
[host][:port][,...]
and paramspec is:
name=value[&...]
Ex: clickhouse://login:password@host:port/database
There are many params for connecting to ClickHouse. Therefore last [?paramspec] is necessary.
Credentials will be verified after connection string accepted if it is not specified.
I propose this solution because it is convenient and general way. It is similar on example from PostgreSQL(details below).
where:
- jdbc:sqlserver:// (Required) is known as the subprotocol and is constant.
- serverName (Optional) is the address of the server to connect to. This address can be a DNS or IP address, or it can be localhost or 127.0.0.1 for the local computer. If not specified in the connection URL, the server name must be specified in the properties collection.
- instanceName (Optional) is the instance to connect to on serverName. If not specified, a connection to the default instance is made.
- portNumber (Optional) is the port to connect to on serverName. The default is 1433. If you're using the default, you don't have to specify the port, nor its preceding ':', in the URL.
- property (Optional) is one or more option connection properties. For more information, see Setting the connection properties. Any property from the list can be specified. Properties can only be delimited by using the semicolon (';'), and they can't be duplicated.
JDBC MySQL protocol//[hosts][/database][?properties]
jdbc:mysql://mysql.db.server:3306/my_database?useSSL=false&serverTimezone=UTC
protocol – jdbc:mysql: // specific param for mysql. There are a lot of values.
host – mysql.db.server:3306
database – my_database
properties – useSSL=false&serverTimezone=UTC
Seconded. For now I'm going to settle for setting an env var like CLICKHOUSE_CONFIG={host:"...",username:"...",password:"..."} and parsing that before creating the client.
Use case
Now you can connect to ClickHouse by specifiying separately host, port, username, password and other parameters.
clickhouse-client --host=... --port=... --user=... --password=...
It is already possible to specify the connection string as a URI in many databases. Example from PostgreSQL
postgresql://localhost:5433/my_database
It is simple, convenient and frequently used. You can just copy the link and connect.
Describe the solution you'd like
I want to achieve next general form of the connection URL:
Ex:
clickhouse://login:password@host:port/database
There are many params for connecting to ClickHouse. Therefore last [?paramspec] is necessary.
Credentials will be verified after connection string accepted if it is not specified.
I propose this solution because it is convenient and general way. It is similar on example from PostgreSQL(details below).
Describe alternatives you've considered
Other implementations are similar:
postgresql://[userspec@][hostspec][/dbname][?paramspec]
The following examples illustrate valid URI syntax:
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]
Examples:
https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15
ODBC driver(SQL Server 2000)
Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
https://www.connectionstrings.com/microsoft-sql-server-odbc-driver/
JDBC Oracle
Connect to Oracle Database SID. In some older versions of the Oracle database, the database is defined as a SID
Connect to Oracle Database Service Name
https://www.baeldung.com/java-jdbc-url-format
protocol//[hosts][/database][?properties]
https://www.baeldung.com/java-jdbc-url-format
Another examples for JDBC provided in screen:
![image](https://user-images.githubusercontent.com/29354173/136739663-c77a10d2-390a-4c89-8fa2-a4d25cdd89a1.png)
https://www.tutorialspoint.com/jdbc/jdbc-db-connections.htm
The text was updated successfully, but these errors were encountered: