ClickHouse/clickhouse-java

clickhouse-jdbc driver did not support connection url parameters

ldcsaa opened this issue · 5 comments

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

image

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.)