Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyway gives No database found to handle jdbc:postgresql://localhost/access_point when deployed as Jar #3722

Closed
boroicamarius opened this issue Aug 2, 2023 · 6 comments

Comments

@boroicamarius
Copy link

Which version and edition of Flyway are you using?

flyway-core:9.21.1

If this is not the latest version, can you reproduce the issue with the latest one as well? (Many bugs are fixed in newer releases and upgrading will often resolve the issue)
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Running SBT assembly to create the final jar file, with SBT run the project works fine

Which database are you using? (Type & version)

PostgreSQL 15.3

Which operating system are you using?

Windows 11

What did you do? (Please include the content causing the issue, any relevant configuration settings, the SQL statement(s) that failed (if any), and the command you ran)

Trying to run the tutorial on my machine, seems that running sbt run to run my main.scala file all works fine but when i run sbt assembly and then I run the jar, the error No database found to handle jdbc:postgresql://localhost/access_point appears

What did you expect to see?

I expected it to run normally and give another error related to the permissions of the user it is trying to login, but I didnt expect for it to not even make it possible to connect to the database

What did you see instead?

this:

❯ java -jar scala-instance.jar
DRIVER: org.postgresql.Driver
PG_URL: jdbc:postgresql://localhost/access_point
PG_USERNAME: scala
PG_PASSWORD: passwordforscala
org.flywaydb.core.api.FlywayException: No database found to handle jdbc:postgresql://localhost/access_point
        at org.flywaydb.core.internal.database.DatabaseTypeRegister.getDatabaseTypeForUrl(DatabaseTypeRegister.java:54)
        at org.flywaydb.core.api.configuration.ClassicConfiguration.setDataSource(ClassicConfiguration.java:1075)
        at org.flywaydb.core.api.configuration.FluentConfiguration.dataSource(FluentConfiguration.java:631)
        at com.scaladocker.Main$.main(Main.scala:43)
        at com.scaladocker.Main.main(Main.scala)
Repository:

https://github.com/boroicamarius/scala-instance

@SchlauFuchs
Copy link

I see this error since dependabot tries to upgrade Flyways from 9.22.3 to 10.1.0

@IRus
Copy link

IRus commented Dec 28, 2023

Apparently, they changed the way flyway is distributed.
If you want Postgres support for example, add this dependency:

dependencies {
    implementation("org.flywaydb:flyway-database-postgresql:10.4.1")
}

Databases supported in flyway-core:

H2DatabaseType
SQLiteDatabaseType
TestContainersDatabaseType

@9Rain
Copy link

9Rain commented Dec 30, 2023

Apparently, they changed the way flyway is distributed. If you want Postgres support for example, add this dependency:

dependencies {
    implementation("org.flywaydb:flyway-database-postgresql:10.4.1")
}

Databases supported in flyway-core:

H2DatabaseType
SQLiteDatabaseType
TestContainersDatabaseType

Many thanks, buddy! You've helped a lot!

@dilunika
Copy link

dilunika commented Jan 6, 2024

Thanks @IRus Following configuration helped me to solve the issue. (if you are using gradle plugin)

buildscript {
    dependencies {
        classpath("org.postgresql:postgresql:42.7.1")
        classpath("org.flywaydb:flyway-database-postgresql:10.4.1")
    }
}

plugins {
    kotlin("jvm") version "1.9.21"
    id("org.flywaydb.flyway") version "10.0.0"
}

@epomatti
Copy link

epomatti commented Jan 24, 2024

"No database found" does not immediately explain what's going on.

Team got this issue and thought it was network related.

Not only did this break existing behavior but also does not convey any meaningful information.

@abdullatheeftk-gulf
Copy link

Thanks @IRus Following configuration helped me to solve the issue. (if you are using gradle plugin)

buildscript {
    dependencies {
        classpath("org.postgresql:postgresql:42.7.1")
        classpath("org.flywaydb:flyway-database-postgresql:10.4.1")
    }
}

plugins {
    kotlin("jvm") version "1.9.21"
    id("org.flywaydb.flyway") version "10.0.0"
}

Thank you. This helped me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants