# Issue in connecting to SQL Server via liquibase

**URL:** <https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386>\
**Category:** General Discussion\
**Created:** [October 6, 2022, 7:21am UTC](https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386 "2022-10-06T07:21:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Renuka](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@Renuka](https://forum.liquibase.org/u/Renuka)\
**Post date:** [October 6, 2022, 7:21am UTC](https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386/1 "2022-10-06T07:21:14Z")

</div>

I am trying to connect to Liquibase to MSSQL Server On-prem. I have all the dependencies installed, facing below error. Please help:

liquibase --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --classpath=“D:\Renuka\Microsoft JDBC Driver 6.0 for SQL Server\sqljdbc\_6.0\enu\jre8\sqljdbc42.jar” --url=“jdbc:sqlserver://localhost:1433;databaseName=test;integratedSecurity=false;” --changeLogFile=“D:\Renuka\test.sql” --username=liquibase --password=xxxxxx update

---

<div class="post-metadata">

**Author:** ![daryldoak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/daryldoak/32/764_2.png) [@daryldoak](https://forum.liquibase.org/u/daryldoak)\
**Post date:** [October 6, 2022, 1:41pm UTC](https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386/2 "2022-10-06T13:41:16Z")

</div>

What error are you getting?

---

<div class="post-metadata">

**Author:** ![Renuka](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@Renuka](https://forum.liquibase.org/u/Renuka)\
**Post date:** [October 7, 2022, 3:34am UTC](https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386/3 "2022-10-07T03:34:55Z")

</div>

Unexpected error running Liquibase: Connection could not be created to jdbc:sqlserver://localhost:1433;databaseName=test;integratedSecurity=false; with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: “PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”. ClientConnectionId:6c1ec0cc-b5ff-4e56-b1fb-ce77390d4fe6

---

<div class="post-metadata">

**Author:** ![daryldoak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/daryldoak/32/764_2.png) [@daryldoak](https://forum.liquibase.org/u/daryldoak)\
**Post date:** [October 7, 2022, 4:16pm UTC](https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386/4 "2022-10-07T16:16:34Z")

</div>

I’m not really familiar withsql-server, but that doesn’t look like a Liquibase specific error, just a sql-server connection issue, missing a cert for connecting. You should make sure you can connect to the sql-server outside of Liquibase before trying to use Liquibase.

Try removing integratedSecurity=false and adding encrypt=false to test connectivity.

---

<div class="post-metadata">

**Author:** ![tabbyfoo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/tabbyfoo/32/748_2.png) [@tabbyfoo](https://forum.liquibase.org/u/tabbyfoo)\
**Post date:** [October 7, 2022, 4:20pm UTC](https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386/5 "2022-10-07T16:20:00Z")

</div>

Hi @Renuka - Welcome to the Liquibase Community!

I did some searching and was able to find an article on the Atlassian website that referenced a similar error. This is the fix they suggested:

> If `-Djavax.net.ssl.trustStore` is present in your JVM arguments, Java will use the truststore configured instead of the default (cacerts). You can verify whether the `-Djavax.net.ssl.trustStore` parameter is causing problems by running the `SSLPoke `test using the same JVM argument which will execute SSLPoke using your custom truststore. For example:

```auto
$JAVA_HOME/bin/java -Djavax.net.ssl.trustStore=/my/custom/truststore -Djavax.net.debug=ssl SSLPoke jira.example.com 443

```

Here’s the reference link: [Unable to connect to SSL services due to "PKIX Path Building Failed" error | Atlassian Support | Atlassian Documentation](https://confluence.atlassian.com/kb/unable-to-connect-to-ssl-services-due-to-pkix-path-building-failed-error-779355358.html)

---

<div class="post-metadata">

**Author:** ![Renuka](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@Renuka](https://forum.liquibase.org/u/Renuka)\
**Post date:** [October 10, 2022, 5:34am UTC](https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386/6 "2022-10-10T05:34:30Z")

</div>

Hey Daryl,

Thanks much. It worked after adding changelog file path to the search path.

---

<div class="post-metadata">

**Author:** ![Renuka](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@Renuka](https://forum.liquibase.org/u/Renuka)\
**Post date:** [October 10, 2022, 5:36am UTC](https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386/7 "2022-10-10T05:36:16Z")

</div>

Thank you. It worked by adding encrypt=false

---

<div class="post-metadata">

**Author:** ![manind63](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@manind63](https://forum.liquibase.org/u/manind63)\
**Post date:** [March 20, 2025, 8:16am UTC](https://forum.liquibase.org/t/issue-in-connecting-to-sql-server-via-liquibase/7386/8 "2025-03-20T08:16:41Z")

</div>

Hello, I am using dockerized version of Liquibase to connect to my local DB server and I am getting connection issues. However I am able to connect to this server using other clients like Dbeaver and sqlcmd. Below is the command I used.

```auto

docker run --rm -e JAVA_OPTS="-Xmx1024m" -v $(pwd):/liquibase/changelog liquibase/liquibase update --url="jdbc:sqlserver://127.0.0.1:14339;databaseName=master;encrypt=true;trustServerCertificate=true" --changelog-file="ChangeLog.xml" --username= *******--password=****** --liquibase-catalog-name=master

```

Error as below.

```auto
Unexpected error running Liquibase: Connection could not be created to jdbc:sqlserver://127.0.0.1:14339;databaseName=master;encrypt=true;trustServerCertificate=true with driver com.microsoft.sqlserver.jdbc.SQLServerDriver. The TCP/IP connection to the host 127.0.0.1, port 14339 has failed. Error: "Connection refused. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".

```
