Error: Unable to connect to the database. Configure the url, user and password!

Hi everyone,

I'm having trouble connecting to my SQL Server database using the CLI. I'm able to connect to Flyway Desktop with the same credentials. Could you help me, please? :)

Flyway version: Flyway OSS Edition 10.4.1
Database: SQL Server
OS: Mac 14.1.2 

CLI

Error:
DEBUG: Java Version: 21.0.1
DEBUG: Unable to load config file: /opt/homebrew/Cellar/flyway/10.4.1/libexec/conf/flyway.conf
DEBUG: Unable to load config file: /Users/user/flyway.conf
DEBUG: Unable to load config file: /Users/user/Library/Mobile Documents/.Trash/flyway_cli/flyway.conf
WARNING: No locations configured and default location 'sql' not found.
DEBUG: Using configuration:
DEBUG: 
DEBUG: Scanning for classpath resources at 'classpath:db/callback' ...
DEBUG: Determining location urls for classpath:db/callback using ClassLoader java.net.URLClassLoader@1e6d1014 ...
DEBUG: Unable to resolve location classpath:db/callback.

ERROR: Unexpected error org.flywaydb.core.api.FlywayException: Unable to connect to the database. Configure the url, user and password!


My conf file is the following:

Path: /conf/flyway.toml

[flyway]
locations = ["filesystem:migrations"]

[environments.default]
locations = ["filesystem:migrations"]
url = "jdbc:sqlserver://localhost;authentication=sqlPassword;databaseName=TEST;encrypt=false;trustServerCertificate=true"
user = "user"
password = "123"

Flyway desktop  String (success connection)

jdbc:sqlserver://localhost;authentication=sqlPassword;databaseName=TEST;encrypt=false;trustServerCertificate=true

Thanks!
Tagged:

Answers

  • Hi Edd,

    Based on your debug output, it doesn't look like your supplied configuration file is being loaded.
    Please could you try explicitly pathing to it via the ConfigFiles parameter?

    Alternatively, you could duplicate the file to this directory:
    /opt/homebrew/Cellar/flyway/10.4.1/libexec/conf/flyway.conf

    I'm not certain it will be applicable here, but please be aware that flyway cannot load both conf and toml files, if both are present, it will only load toml.
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?
  • GeorgeSDubeGeorgeSDube Posts: 1 New member
    edited November 14, 2024 1:04AM
    Hi Edd,

    Based on your debug output, it doesn't look like your supplied configuration file is being loaded.
    Please could you try explicitly pathing to it via the ConfigFiles parametergeometry dash deadlocked

    Alternatively, you could duplicate the file to this directory:
    /opt/homebrew/Cellar/flyway/10.4.1/libexec/conf/flyway.conf

    I'm not certain it will be applicable here, but please be aware that flyway cannot load both conf and toml files, if both are present, it will only load toml.
    The issue where users cannot connect to their SQL Server database using Flyway CLI, I think it can connect via path to configuration file using ConfigFiles parameter or by copying configuration file to default location.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file