user2023141
user2023141

Reputation: 1223

Spring-boot Maven flyway Unable to connect to the database. Configure the url, user and password

Im my spring-boot application, when executing "mvn flyway:migrate" , I have the following exception:
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:6.4.1:migrate (default-cli) on project test-data-api: org.flywaydb.core.api.FlywayException: Unable to connect to the database. Configure the url, user and password!

Even when replacing the flyway placeholders (${flyway.url}, ${flyway.user}, ${flyway.user}) in the POM.XML file with Strings representing url, user and password, the above error occurs.

application.yaml:

flyway:
    url: jdbc:oracle:thin:@//xxxxxxxxx.ch:1521/yyyyy
    user: xxxx
    password: xxxxxxx

spring:
  flyway:
    url: jdbc:oracle:thin:@//xxxxxxxxx.ch:1521/yyyyy
    user: xxxx
    password: xxxxxxx

pom.xml

<build>
    <plugins>
        <plugin>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-maven-plugin</artifactId>
            <version>5.2.4</version>
            <configuration>
                <url>${flyway.url}</url>
                <user>${flyway.user}</user>
                <password>${flyway.password}</password>
            </configuration>
            <dependencies>
            <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>${oracle.version}</version>
            </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

Upvotes: 1

Views: 2225

Answers (1)

RaduP
RaduP

Reputation: 127

It seems that you are using an old version for the flyway-maven-plugin plugin. As of today the most recent version is 7.8.1

Try to use this version and see if the error still occurs.

Upvotes: 0

Related Questions