MSSQL connection not working with Java 17

534 views
Skip to first unread message

Se Ri

unread,
May 3, 2023, 2:53:20 AM5/3/23
to SQL Workbench/J - DBMS independent SQL tool
Hi,
I´ve migrated to Java 17 (64 bit) and now I cannot login into my MSSQL connection anymore.
It seems a JAVA issue. I tried it with Java 11 and I was able to connect to the MSSQL database.

Now I got the following exception:
The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]". ClientConnectionId:983ef684-bdb2-4264-aca4-5dbabcc24832 [SQL State=08S01]

Any idea to fix this?

Thomas Kellerer

unread,
May 4, 2023, 3:37:07 AM5/4/23
to sql-wo...@googlegroups.com
I don't use SQL Server very often, but as far as I know, newer Microsoft JDBC drivers use encrypted conncections by default.

If your SQL Server is not configured for encrypted connections you need to disable encryption.
I think this should be as simple as appending ;encrypt=false to the JDBC URL

Please consult the manual for the Microsoft JDBC driver for more details.
This is not directly related to SQL Workbench/J


Se Ri schrieb am 03.05.2023 um 08:51:
> Hi,
> I´ve migrated to Java 17 (64 bit) and now I cannot login into my MSSQL connection anymore.
> It seems a JAVA issue. I tried it with Java 11 and I was able to connect to the MSSQL database.
>
> Now I got the following exception:
> /The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]". ClientConnectionId:983ef684-bdb2-4264-aca4-5dbabcc24832 [SQL State=08S01] /

Se Ri

unread,
May 4, 2023, 3:57:30 AM5/4/23
to SQL Workbench/J - DBMS independent SQL tool
Thanks, I´ve commented it out in the java.security file  (in path: jre/conf/security/) and now it´s working...
#jdk.tls.disabledAlgorythmus......

Thanks.

Chris Young

unread,
May 5, 2023, 3:08:06 PM5/5/23
to SQL Workbench/J - DBMS independent SQL tool
I was able to fix this by adding this property to the connection string:
TrustServerCertificate=True;

Reply all
Reply to author
Forward
0 new messages