SQL Server Jdbc driver unable to connect to database using TLS1.2

5.4k views Asked by At

I would like to connect to my database instance using TLS1.2 from a Linux instance and I am unable to do so. I am using the following configuration

  1. Java JDK : Amazon corretto openjdk version : "1.8.0_252"
  2. JDBC driver : Microsoft SQL server mssql-jdbc:8.2.2.jre8
  3. Connection string : jdbc:sqlserver://[my database url]:1433;SSLProtocol=TLSv1.2
  4. Operating system: Amazon Linux
  5. Database: Microsoft SQL Server 16 running on a Windows machine
  6. I have turned off TLS1 and TLS1.0 on the database to force my java application to use only TLS1.2

The following error appears when my application tries to connect to the database:

com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: No appropriate protocol (protocol is disabled or cipher suites are inappropriate).

1

There are 1 answers

0
Ruch On

This maybe not the best solution but to get my application working i used,

java.security.Security.setProperty("jdk.tls.disabledAlgorithms","SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024,EC keySize < 224, 3DES_EDE_CBC, anon, NULL");

I upgraded from Java 8.0.202 to 8.0.291 and got the issue you have mentioned which had disabled TLS 1.0 and 1.1. The property i have set above are the settings from Java 8.0.202