Amir nazary
Amir nazary

Reputation: 705

Flyway ERROR: No database found to handle jdbc:clickhouse://

I am trying to use Flyway for versioning a clickhouse database. My flyway.conf file looks like this:

flyway.url=jdbc:clickhouse://<host>:<port>/<database>?ssl=true
flyway.user=<user>
flyway.password=<password>

I want to use the CLI tool for using flyway, and I have a running docker image of fly way by executing the following commands (got it from this tutorial)

docker pull redgate/flyway
docker run --rm redgate/flyway

After running the docker run --rm -v <paths> redgate/flyway migrate, I get the following error:

ERROR: No database found to handle jdbc:clickhouse://<host>:<port>/<database>?ssl=true

SSL is required for my connection.

Based on this clickhouse documentation I know that there is a support for clickhouse in flyway but not sure how the flyway.conf setup should look like.

Upvotes: 1

Views: 1315

Answers (1)

Thiago Ruiz
Thiago Ruiz

Reputation: 61

So... it seems that you need more than just the clickhouse jdbc jar to do this (and there is an open PR for the flyway people: https://github.com/flyway/flyway/pull/3611)

What I did:

  1. Created a very simple pom.xml only to download all the clickhouse jdbc dependencies

  2. Cloned (and builded it) the flyway's fork from the guy who created the clickhouse plugin (from here: https://github.com/sazonov/flyway/tree/clickhouse-support, note that the plugin is on branch "clickhouse-support")

  3. Created a simple Dockerfile to add everything on the base flyway/flyway docker image:

  • the dependencies from the driver (COPY to /flyway/drivers/ dir)
  • the new jar file <cloned_dir>/flyway-community-db-support/target/flyway-community-db-support-*.jar (COPY to /flyway/lib/community/ dir)

After all that, I was able to make my migrations work on Clickhouse

Upvotes: 0

Related Questions