I am trying to connect to SQL Server 2014 with Java 7 via JDBC driver and the error that the app throws is :
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."
My code is:
driver ="com.microsoft.sqlserver.jdbc.SQLServerDriver";
url ="jdbc:sqlserver://Ip:port;databasename=xxx";
user = "xxx";
pass = "xxx";
Class.forName(driver);
connection = DriverManager.getConnection(url, user, pass);
I downloaded the ODBC driver package from MSDN and have tried using each of the following in turn: sqljdbc.jar
, sqljdbc4.jar
, sqljdbc41.jar
, and sqljdbc42.jar
, but I got the same error each time.
sqljdbc4.jar
. That one works for me when connecting to a SQL Server instance that requires an SSL connection. – Gord Thompsonsqljdbc4.jar
. If that fails then your problem is more fundamental (e.g., SQL Server settings, network configuration, etc.). If it succeeds, then you'll need to dig deeper into the details of your Tomcat configuration. (Also, remember to include @UserName when replying to a comment.) – Gord Thompson