繁体   English   中英

连接到SQLServer时发生JDBC错误

[英]JDBC error while connecting to SQLServer

在我的程序中使用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.

我在Java 8,SQL Server 2008,sqlserver驱动程序4.2时遇到了相同的问题
在收到其他有关将Java 7与该sqldriver一起使用的主要/次要异常的投诉后
似乎该问题是因为(如某人所述)sql服务器数据库所在的网络与我运行代码的网络不同。.第一个网络为172.xxx,第二个网络为15.xxx
多亏了下面线程中的pepole,所以用jtds驱动程序替换sqlserver驱动程序的工作非常有魅力。
https://social.msdn.microsoft.com/Forums/sqlserver/zh-CN/a36ea16c-cc78-4054-bd02-dd637b1e9a81/warning-tdschannel-when-attempting-to-connect?forum=sqldataaccess

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM