Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Java 16 #1552

Closed
andvasp opened this issue Mar 26, 2021 · 1 comment · Fixed by #1579
Closed

Add support for Java 16 #1552

andvasp opened this issue Mar 26, 2021 · 1 comment · Fixed by #1579
Projects

Comments

@andvasp
Copy link

andvasp commented Mar 26, 2021

Driver version

9.2.1.jre15

SQL Server version

Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64) Jun 28 2012 08:36:30 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)

Client Operating System

Windows 10

JAVA/JVM version

openjdk 16 2021-03-16
OpenJDK Runtime Environment (build 16+36-2231)
OpenJDK 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)

Table schema

None

Problem description

Cannot connect on Sql Server using Java 16 but works if I use older version like Java 15.

Stack trace:
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to sql server by using Secure Sockets Layer (SSL). Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]". ClientConnectionId:d51a5a78-8336-46c9-8a43-557dd660faf9
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3206)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1916)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2760)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2418)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2265)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1291)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:881)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
at com.gerdau.smdo.controller.TestSqlConnection.main(TestSqlConnection.java:15)
Caused by: javax.net.ssl.SSLHandshakeException: The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:356)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:312)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:303)
at java.base/sun.security.ssl.ServerHello$ServerHelloConsumer.onServerHello(ServerHello.java:975)
at java.base/sun.security.ssl.ServerHello$ServerHelloConsumer.consume(ServerHello.java:897)
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:480)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:458)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:199)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:171)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1497)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1403)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:441)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:412)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1824)

Reproduction code

    Logger logger = Logger.getLogger("com.microsoft.sqlserver.jdbc.Statement");
    logger.setLevel(Level.FINER);
 
    try (Connection connection = DriverManager
        .getConnection("jdbc:sqlserver://localhost:1433;databaseName=master", "username, "userpassword")) {
        Statement stmt = connection.createStatement();
        stmt.execute("SELECT 1");
    } catch (SQLException exception) {
        exception.printStackTrace();
    }
@lilgreenbird
Copy link
Member

lilgreenbird commented Mar 26, 2021

hi @andvasp

Java 16 is not supported yet currently the driver only supports up to Java 15. Please see System requirements, the name of the jar file will tell you which JRE version it's for. However, we will be adding support soon not in the upcoming release but the following one that's targeted for end of May.

@lilgreenbird lilgreenbird added this to In progress in MSSQL JDBC Apr 12, 2021
@lilgreenbird lilgreenbird linked a pull request May 20, 2021 that will close this issue
MSSQL JDBC automation moved this from In progress to Closed Issues May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
MSSQL JDBC
  
Closed Issues
Development

Successfully merging a pull request may close this issue.

2 participants