The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Unexpected rethrowing".), - SSL error

Nishanth M 0 Reputation points
2025-09-15T03:41:18.2033333+00:00

The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Unexpected rethrowing".), - application received this error while connecting the DB.

SQL Server Database Engine
{count} votes

1 answer

Sort by: Most helpful
  1. K Durga Prasanna 15 Reputation points Microsoft External Staff
    2025-11-03T06:13:58.22+00:00

    Hi @Nishanth M
    Thanks for reaching out to the Microsoft Q & A Forum.

    The error occurs due to a TLS protocol mismatch between the SQL Server and the client application. This typically happens when the SQL Server instance is running on an older version, such as SQL Server 2008, 2012, or 2014, which only supports TLS 1.0/1.1. Meanwhile, the client application uses a modern Java runtime (Java 11 or later) and a newer Microsoft JDBC driver (version 9.x or higher), which require TLS 1.2 or newer and block deprecated TLS protocols. As a result, the SSL/TLS handshake fails before encryption is established, and the JDBC driver throws the generic “Unexpected rethrowing” exception.

    To resolve this upgrade the SQL Server to enable TLS 1.2 support and ensure that TLS 1.2 is enabled in the Windows Schannel registry. This approach aligns with current security standards and ensures compatibility with modern encryption protocols. Once TLS 1.2 is fully enabled on the SQL Server host and its operating system, the connection will succeed seamlessly with the existing modern JDBC driver and Java runtime.  

    I hope this information helps. Please do let us know if you have any further queries.

    Thank you


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.