1

在我的程序中使用 JDBC 连接我得到以下异常。我正在使用 jdk1.6.0_25。

例外:

com.microsoft.sqlserver.jdbc.TDSChannel enableSSL WARNING: TDSChannel ( ConnectionID:1 TransactionID:0x0000000000000000) SSL handshake failed: RSA premaster secret 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: RSA premaster secret error.
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(Unknown    Source) 
at com.microsoft.sqlserver.jdbc.TDSChannel.throwSSLConnectionFailed(Unknown    Source) 
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(Unknown    Source) 
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown    Source) 
at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown    Source) 
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown    Source) 
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)    
at java.sql.DriverManager.getConnection(Unknown Source) 
at java.sql.DriverManager.getConnection(Unknown Source) 
at com.exterro.db.Dummy.main(Dummy.java:22) 
The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: RSA premaster secret error.
4

1 回答 1

1

我在 java 8、SQL server 2008、sqlserver driver 4.2 上遇到了同样的问题
在有其他关于将 java 7 与该 sqldriver 一起使用的主要/次要异常的投诉之后
似乎问题是因为(正如有人所说)sql server 数据库在网络与我运行代码的网络不同。第一个网络是 172.xxx,第二个
15.xxx
.msdn.microsoft.com/Forums/sqlserver/en-US/a36ea16c-cc78-4054-bd02-dd637b1e9a81/warning-tdschannel-when-attempting-to-connect?forum=sqldataaccess

于 2016-04-27T07:47:58.607 回答