Connect to Azure SQL DB

I’m brand new to Liquibase and I’m having trouble getting Liquibase to connect to Azure SQL DB using SQL Server authentication. I’m 99% certain that firewall rules aren’t the issue because the IP address my pipeline connects to the internet from is allowed on my Azure SQL DB. When Liquibase runs, it fails to create a successful connection. It will run for about fifteen minutes and then gives the following error:

Unexpected error running Liquibase: Connection could not be created to jdbc:sqlserver://sqlserver-mydatabase.database.windows.net:1433;database=test;integratedSecurity=false;encrypt=true;trustServerCertificate=true with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out (Read failed)

I’ve tried running the official Github Update Action, but get the same behavior. To try to troubleshoot, I’ve been running the cli directly in my pipeline and am running the status command. Here is what I’m passing in:

./liquibase-4_21_1/liquibase --username=my_user --*** --url="jdbc:sqlserver://sqlserver-mydatabase.database.windows.net:1433;database=test;integratedSecurity=false;encrypt=true;trustServerCertificate=true" --changeLogFile=changelogs/changelog-dev.xml --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --log-level=INFO --classpath="mssql-jdbc-9.2.1.jre11.jar" status

Configuration Details
Running on unbuntu hosted on-prem (hence known IP)
I’ve added the Liquibase Archive to my repo
My pipeline first installs Java 8, temurin
Then I call status. If I call update, I get the same behavior

Background:
I’m moving a pipeline from on-prem Jenkins to Github Actions, with the action runner hosted on Linux on-prem. The old Jenkins pipeline is using Liquibase to connect to an on-prem Microsoft SQL Server 2019 instance and this has been working fine for a while. I can point my pipeline to the on-prem SQL Server and it is able to connect. But as mentioned above, I’m reasonably sure this isn’t a firewall issue.

Any help would be greatly appreciated.

Hi @IndyCaribou,

This looks strange, especially the “Read failed” part of the error. This typically indicates a network error. Since you’re setting the --log-level=INFO, you should get a full stack trace when it fails. That might help diagnose where the issue is located.

Can you share the full stack trace?

-PJ

Hi @PJatLiquibase, I believe I have isolated this to something going on in our network. I’m hoping to prove that today. But I’ve created a test app that makes the same connection from C# using ado and I get the same behavior, so it’s not an issue with Liquibase. But for the benefit of anybody reading this, here is the full stack trace:

Starting Liquibase at 18:53:10 (version 4.19.0 #6648 built at 2023-01-17 15:02+0000)
Liquibase Version: 4.19.0
Liquibase Open Source 4.19.0 by Liquibase
[2023-05-08 19:09:07] SEVERE [liquibase.integration] Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
liquibase.exception.CommandExecutionException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.command.CommandScope.execute(CommandScope.java:186)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:55)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:24)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(LiquibaseCommandLine.java:352)
at liquibase.Scope.child(Scope.java:189)
at liquibase.Scope.child(Scope.java:165)
at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:317)
at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:84)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at liquibase.integration.commandline.LiquibaseLauncher.main(LiquibaseLauncher.java:107)
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:140)
at liquibase.integration.commandline.Main.doMigration(Main.java:1482)
at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:396)
at liquibase.Scope.lambda$child$0(Scope.java:180)
at liquibase.Scope.child(Scope.java:189)
at liquibase.Scope.child(Scope.java:179)
at liquibase.Scope.child(Scope.java:158)
at liquibase.integration.commandline.Main$1.run(Main.java:395)
at liquibase.integration.commandline.Main$1.run(Main.java:217)
at liquibase.Scope.child(Scope.java:189)
at liquibase.Scope.child(Scope.java:165)
at liquibase.integration.commandline.Main.run(Main.java:217)
at liquibase.command.AbstractCliWrapperCommandStep.run(AbstractCliWrapperCommandStep.java:32)
at liquibase.command.CommandScope.execute(CommandScope.java:172)
… 20 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:221)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:179)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:144)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:94)
… 33 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:35)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:218)
… 36 more
Caused by: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.database.jvm.JdbcConnection.open(JdbcConnection.java:91)
at com.datical.liquibase.ext.database.jvm.ProJdbcConnection.open(Unknown Source)
at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:32)
… 37 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3806)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:2109)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.prelogin(SQLServerConnection.java:3517)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3325)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2950)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2790)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1663)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1064)
at liquibase.database.jvm.JdbcConnection.open(JdbcConnection.java:83)
… 39 more
Caused by: java.net.SocketException: Connection timed out
at java.base/sun.nio.ch.NioSocketImpl.implRead(Unknown Source)
at java.base/sun.nio.ch.NioSocketImpl.read(Unknown Source)
at java.base/sun.nio.ch.NioSocketImpl$1.read(Unknown Source)
at java.base/java.net.Socket$SocketInputStream.read(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.readInternal(IOBuffer.java:1207)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.read(IOBuffer.java:1194)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:2100)
… 46 more

Unexpected error running Liquibase: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be

liquibase.exception.CommandExecutionException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.command.CommandScope.execute(CommandScope.java:186)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:55)
at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:24)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(LiquibaseCommandLine.java:352)
at liquibase.Scope.child(Scope.java:189)
at liquibase.Scope.child(Scope.java:165)
at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:317)
at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:84)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at liquibase.integration.commandline.LiquibaseLauncher.main(LiquibaseLauncher.java:107)
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:140)
at liquibase.integration.commandline.Main.doMigration(Main.java:1482)
at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:396)
at liquibase.Scope.lambda$child$0(Scope.java:180)
at liquibase.Scope.child(Scope.java:189)
at liquibase.Scope.child(Scope.java:179)
at liquibase.Scope.child(Scope.java:158)
at liquibase.integration.commandline.Main$1.run(Main.java:395)
at liquibase.integration.commandline.Main$1.run(Main.java:217)
at liquibase.Scope.child(Scope.java:189)
at liquibase.Scope.child(Scope.java:165)
at liquibase.integration.commandline.Main.run(Main.java:217)
at liquibase.command.AbstractCliWrapperCommandStep.run(AbstractCliWrapperCommandStep.java:32)
at liquibase.command.CommandScope.execute(CommandScope.java:172)
… 20 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:221)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:179)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:144)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:94)
… 33 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:35)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:218)
… 36 more
Caused by: liquibase.exception.DatabaseException: Connection could not be created to *** with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at liquibase.database.jvm.JdbcConnection.open(JdbcConnection.java:91)
at com.datical.liquibase.ext.database.jvm.ProJdbcConnection.open(Unknown Source)
at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:32)
… 37 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Connection timed out ClientConnectionId:147adaa5-8b29-4987-a403-9f897a9570be
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3806)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:2109)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.prelogin(SQLServerConnection.java:3517)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3325)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2950)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2790)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1663)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1064)
at liquibase.database.jvm.JdbcConnection.open(JdbcConnection.java:83)
… 39 more
Caused by: java.net.SocketException: Connection timed out
at java.base/sun.nio.ch.NioSocketImpl.implRead(Unknown Source)
at java.base/sun.nio.ch.NioSocketImpl.read(Unknown Source)
at java.base/sun.nio.ch.NioSocketImpl$1.read(Unknown Source)
at java.base/java.net.Socket$SocketInputStream.read(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.readInternal(IOBuffer.java:1207)
at com.microsoft.sqlserver.jdbc.TDSChannel$ProxyInputStream.read(IOBuffer.java:1194)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:2100)
… 46 more

1 Like