Liquibase Docker Can't Connect to DB but Liquibase CLI can

I’m attempting to verify liquibase docker can connect to my existing running database the same way via docker the same way I do liquibase CLI does. But I’m getting errors. I’ve logged into the container and have verified I can reach my database inside the container using debian/linux commands without issue.

My first test is to generate a changelog in the mysql.sql format to verify network connection. I’ve used the default included driver and included my own. I’ve also used an ip address and urls and both fail.

I’m getting liquibase.exception.DatabaseException: Connection could not be created to jdbc:mysql://url:port/db with driver com.mysql.cj.jdbc.Driver. Communications link failure…

My looks like this:

classpath: /liquibase/changelog/mysql-connector-java-8.0.25.jar
driver: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://url:port/db
username: usr
password: pwd
referenceDriver: com.mysql.cj.jdbc.Driver
referenceUrl: jdbc:mysql://url:port/db

docker run --rm -v /myfolder:/liquibase/changelog liquibase/liquibase --defaultsFile=/liquibase/changelog/ --changeLogFile=output.mysql.sql generateChangeLog

Hi @dba4today ,

Try this out, add autoReconnect=true"&"useSSL=false paramas in the url.
For example, jdbc:mysql://url:port?autoReconnect=true"&"useSSL=false Sometimes these parameters are important in mysql db’s.

This solved our problem trying to connect to a RDS database! Thank you!

The useSSL=false parameter did the trick!