Error: Unable to connect to the database. Configure the url, user and password!
Edd
Posts: 1 New member
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:
My conf file is the following:
Path: /conf/flyway.toml
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!
Flyway desktop String (success connection)
jdbc:sqlserver://localhost;authentication=sqlPassword;databaseName=TEST;encrypt=false;trustServerCertificate=true
Thanks!
Answers
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.