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

I used this code to create a connection to SQL Server.

String connectionUrl = "jdbc:sqlserver://IP:1433;" +
        "databaseName=db;user=db;password=pwd";
    Connection con = null;
  try {
     // Establish the connection.
     Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
     con = DriverManager.getConnection(connectionUrl);
        return "true";
  }

  // Handle any errors that may have occurred.
  catch (Exception e) {
     e.printStackTrace();
  }

but i got this error:

com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: “Socket closed”. ClientConnectionId:5975fad5-8f8d-496a-a2bb-bff3a8d1a755

Can anybody help me? Thanks in advance



Azure scheduler -; The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

Getting below error Http Action – Request to host ‘sipoc.cloudapp.net’ failed: TrustFailure The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

Visual Studio 2010 nuget error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

Whenever I’m trying to install something or even just list the packages I get this error The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel I

Could not establish trust relationship for the SSL/TLS secure channel with subject alternative name certificate

I’m getting a System.Net.WebException The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel The inner exception is System.Security.Authenticatio

MSDEPLOY using MSBUILD from TFS 2010 -could not establish trust relationship for the SSL/TLS secure channel

I am getting following error. ERR: could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure Should I change any th

Server Load for SAP Secure Network Connection Encryption

If you turn on encryption in SAP between the client and the server using the Secure Network Connection, then is there a load placed on the server to do all the encryption work? How big a load? Is it e

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

I am developing a Metro style app using C# and xaml. In my application I got the error when calling to a web service: The underlying connection was closed: Could not establish trust relationship for

C# – secure `sockets` with SSL

hi i have a socket connection (server) developed with methods available in using System.Net.Sockets; using System.Net; is it possible to secure the data communication in this sockets ? specially imp

How to establish a secure connection by using Synapse?

I’m testing Synapse and want to know how can I establish a secure connection. I noticed it supports SSL, but I’m not sure whether it suits my needs. I don’t have a certificate from CA. I just want to

How do I secure SQL Server database connection using certificate?

Currently I have Windows App which is directly opening database connection (SQL Server is sitting remotely) using SqlConnection object without any proper security measure. Now I need to secure databa

OpenSSL establish connection between client and server

Im working on this assignment using Open SSL and C++. I need to establish a secure connection between a client and a server and then transfer a encrypted file. Could anyone give me any references (boo

Answers

Is it

databaseName=MyDB

or

database=MyDB

?

Try the latter.

Are you on a Windows Machine? http://www.microsoft.com/en-us/download/details.aspx?id=24009

Download that and try to talk to your server outside of your code. The port query tool will show you if its a firewall (or similar) issue, outside of the code.

Check out this Microsoft JDBC Blog post:

for resolve SSL problems with SQLServer (specially for android clients:JDBC driver can not be used effectively in the Android OS on unfortunately) try to using jDTS:

jTDS is an open source 100% pure Java (type 4) JDBC 3.0 driver for Microsoft SQL Server (6.5, 7, 2000, 2005, 2008 and 2012)