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;