ClickHouse / clickhouse-java

ClickHouse Java Clients & JDBC Driver
https://clickhouse.com
Apache License 2.0
1.45k stars 537 forks source link

connect() should fail if specifying a non-existent database in the JDBC URL #1281

Open rogerbj opened 1 year ago

rogerbj commented 1 year ago

Describe the bug

Specifying a non-existent database in the JDBC URLs results in the connection being established but following server calls fails.

Steps to reproduce

  1. Specify a non-existent database in the URL, i.e. jdbc:clickhouse://<host>:<port>/database

Expected behaviour

The connect should fail if the specified database doesn't exist rather than following calls after connect fails.

ClickHouse versions

zhicwu commented 1 year ago

Thanks @rogerbj. But you can still issue queries against other databases, right? Or create the database before any query as mentioned in #826.

However, I do agree it's a bit confusing. With option createDatabaseIfNotExist, connecting to a database that doesn't exist makes no real sense any longer.