The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption.

The driver could not establish a secure connection to SQL Server using Secure Sockets Layer (SSL) encryption.

While using the application connection, we are getting the error:

The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server returned an incomplete response. The connection has been closed.

We checked the connection setting and on the net, we found to add the following in the connection setting to fix the issue:

Try either and check the error : encrypt=true; OR trustServerCertificate=true; 

Before:
jdbc:sqlserver://servername:portnumber;DatabaseName=dbName;

After changes my error is fixed:
jdbc:sqlserver://servername:portnumber;DatabaseName=dbName;encrypt=true;
OR
jdbc:sqlserver://servername:portnumber;DatabaseName=dbName;encrypt=true;trustServerCertificate=true;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.