clickhouse-jdbc driver did not support connection url parameters
Describe the bug
Clickhouse JDBC connection URL with parameters would be always uses default database, like this:
# the default database is NOT `my_db`, but the `default` db.
url: jdbc:clickhouse://192.168.56.23:8123/my_db?custom_http_params=async_insert=1,wait_for_async_insert=1
If cut the url parameter, that's OK, like this:
# the default database is `my_db`
url: jdbc:clickhouse://192.168.56.23:8123/my_db
- I had test many version of clickhouse JDBC driver, 0.4.6, 0.5.0, 0.6.0 etc.
- ClickHouse Server version: 24.1
Good day, @ldcsaa! Thank you for reporting the issue! Am I correct that there are two problems:
- when query parameters are set then wrong database is selected
- you would like to pass some parameters thru JDBC url
for the last one - have you tried to url encode this part - async_insert=1,wait_for_async_insert=1 ?
Good day, @ldcsaa! Thank you for reporting the issue! Am I correct that there are two problems:
- when query parameters are set then wrong database is selected
- you would like to pass some parameters thru JDBC url
for the last one - have you tried to url encode this part -
async_insert=1,wait_for_async_insert=1?
I did not tried to encode URL, just refer to this guide: Asynchronous Inserts
Triage Report
- Bug and should work as documented.
There is a version that solves this problem ?
Good day, @ldcsaa!
I've found the bug that causes the problem - , is used as delimiter for endpoints definitions (http://host1,host2,host3/my_db). This will be fixed in 0.7.0.
However, custom_settings should be used instead custom_http_params (should not be used because depends on protocol and actually is not working as expected.)
@chernser I've updated clickhouse-driver to version 0.8, but passing data like jdbc:clickhouse://127.0.0.1:8123/mysql?custom_settings=log_comment=devel doesn't work anymore. Is this method no longer allowed? Is there any way to achieve the same effect as in version 0.5?
Good day, @wtao54101 !
Please use clickhouse_settings_log_comment instead to do this configuration.
We have aligned Java client with other language clients and all server side settings should have prefix clickhouse_settings_ (see https://clickhouse.com/docs/integrations/language-clients/java/client#server-settings).
Please let me know if it helped or rise an issue.
Thanks!