使用 SQLServer 驱动程序和 Java 1.6.0_29 Driver.getConnection 挂起
我不知道该在哪里写一些东西,所以决定在这里写。
经过很长一段时间调试我的程序后,我发现调用 Driver.getConnection(string, string, string) 挂起调用线程。为什么(?),我真的不知道,但我可以发现这种情况发生在 java 1.6.0_29 上,而不是 java 1.6.0_26 上。
完整环境:
操作系统:在 redhat 6.1 和 Windows 2008 上测试
驱动程序:MS SQL Server JDBC 驱动程序版本 3.0.1301.101
Java 版本: 1.6.0_26 和 1.6.0_29
正如我之前所说,它适用于 1.6.0_26。
有谁知道可能是什么原因造成的吗?也许是一些开发商? :p
最好的问候,
瑞
I didn't know where to write something about this and decided to do it here.
After loooong time debugging my program I could find out that calling Driver.getConnection(string, string, string) hangs the calling thread. Why(?), I really don't know, but I could find out that this happens with java 1.6.0_29 and not with java 1.6.0_26.
Full enviroment:
OS: Tested on both redhat 6.1 and Windows 2008
Driver: MS SQL Server JDBC Driver version 3.0.1301.101
Java Versions: 1.6.0_26 and 1.6.0_29
As I previously told it works with 1.6.0_26.
Is there anyone that has any idea what's possibly causing this? Maybe some developer? :p
Best regards,
Rui
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
我遇到了完全相同的行为:
我在 Windows 7 64 位 PC 上同时使用 Oracle XE 和 MS SQL Server Express - 我从 1.6.0_27(x64 版本)升级到 java 1.6.0_29,并且惊讶地发现相同的程序在能够连接到 Oracle XE,但不能连接到 MS SQL Server...
我将问题追溯到 javax.sql.DataSource.getConnection() ,它永远挂在了那里 - 因为这个只是一个接口,jdbc 驱动程序引起了我的怀疑...
我正在使用 MS SQL Server JDBC 驱动程序 3.0.1301.202,我什至更新到 SQL Server CTP(“社区技术预览”)4.0.1722.1,因为我的怀疑是它必须对 jdbc 驱动程序执行某些操作 - 但没有成功:仍然挂起!
我的解决方法是降级到 1.6.0_27,然后——砰:一切又恢复正常了!
此致
埃里希
I encountered exactly the same behaviour:
I use both Oracle XE and MS SQL Server Express on my Windows 7 64bit PC - I upgraded to java 1.6.0_29 from 1.6.0_27 (the x64 version) and was surprised to see that the same programs where able to connect to Oracle XE but not to MS SQL Server...
I traced down the problem to
javax.sql.DataSource.getConnection()
where it was hanging forever - because this is just an interface, the jdbc drivers raised my suspicion...I'm using the MS SQL Server JDBC Driver 3.0.1301.202 and I even updated to SQL Server CTP (the "community technical preview") 4.0.1722.1 because my suspicion was that it has to do something with the jdbc driver - but no success: still hanging!
My workaround was to downgrade to 1.6.0_27 and -- bang: everything was fine again!
best regards
Erich
转载:
SQL 驱动程序 2.0组合出现问题
SQL 驱动程序 3.0
SQL 驱动程序 4.0 CTP 3
jTDS SQL 驱动程序 1.2.5
SQL Server 2008R2
Java 1.6.0_29
更改 SQL Server 版本(在 2005 年和 2008 年测试)或 Java 版本(1.6.0_27、1.7.0_1),问题不再出现。
客户端/服务器操作系统:Windows 2008R2
已添加到 Java Bug 数据库,并且正在处理由 Oracle 开发。
交叉发布于 Microsoft MSDN 数据访问论坛(接受的答案:升级到java 7)和Oracle Java JDBC 论坛(此处添加的信息是也添加到 Java Bug 数据库中)。
Reproduced:
Problem occurs with combination of
SQL driver 2.0
SQL driver 3.0
SQL driver 4.0 CTP 3
jTDS SQL Driver 1.2.5
SQL server 2008R2
Java 1.6.0_29
Change either SQL server version (tested on 2005 & 2008) or Java version (1.6.0_27, 1.7.0_1), and the problem doesn't occur anymore.
Client / Server OS: Windows 2008R2
Added to the Java Bug Database and is being worked on by Oracle.
Crossposted on Microsoft MSDN Data Access Forum (accepted answer: upgrade to java 7) and Oracle Java JDBC Forums (information that is added here, is also added to the Java Bug Database).
请参阅此处的解决方案
https://forums.oracle.com/forums/thread.jspa ?messageID=9954398&tstart=0
http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/97dce8fd-6487-4bca-80b0-492167db3e0d
“显然,这与 SSL 使用有关,可以通过替换 jsse.jar 来缓解jre/lib 与早期版本的版本,例如 1.6.0_27 版本中的版本,我一直感到困惑。 1.6.0_29 使用 MS JDBC 和不执行安全连接的旧版 SQL Server '05 设置所有较新的服务器 (SQL Server '08 R2) 都会失败,因为它们需要 SSL,并且 Java 1.6.0_29 无法使用 jTDS 或 MS JDBC。在这种情况下。”
See the solution here
https://forums.oracle.com/forums/thread.jspa?messageID=9954398&tstart=0
http://social.msdn.microsoft.com/Forums/en/sqldataaccess/thread/97dce8fd-6487-4bca-80b0-492167db3e0d
"Apparently, this is related to SSL use and can be mitigated by replacing the jsse.jar in the jre/lib with that from an earlier version, for instance out of the 1.6.0_27 release. I've been confused by 1.6.0_29 working with MS JDBC and older SQL Server '05 setups which are not doing secure connections. All the newer servers (SQL Server '08 R2) fail as they require SSL and Java 1.6.0_29 does not work using jTDS or MS JDBC in this case."
仅供参考,1.6 系列中似乎有一个新的步骤 build #30 修复了该问题:
https://bugs.java.com/bugdatabase/view_bug?bug_id=7103725
As an FYI, it appears that there's a new step build #30 in the 1.6 family which fixes the issue:
https://bugs.java.com/bugdatabase/view_bug?bug_id=7103725
我有同样的挂起问题,并且仅适用于 java 1.6.0_29。我注意到如果升级到 7.1 问题就会消失
I have the same hang problem, and only with java 1.6.0_29. I noticed that if I upgrade to 7.1 the problem goes away
我很高兴找到这个论坛。我在升级时遇到了同样的问题(我实际上从 1.6.0_22 升级到 1.7.1,然后降级到 1.6.0_29,当问题发生时。
我注意到的另一件事:如果我使用 1.6.0_29 jre,它会失败,但是如果我使用 1.6.0_29 jdk,它就可以工作...我花了大约一天的时间试图弄清楚为什么 eclipse(使用 jre)失败当myEclipse(使用jdk)正在工作时......
如何将错误引入到这么晚的版本中?(我正在推荐java生产版本)。
I am so happy that I have found this forum. I had the same problem on upgrade (I actually upgraded from 1.6.0_22 to 1.7.1, then downgraded to 1.6.0_29, when the problem has occurred.
One more thing I have noticed : if I use 1.6.0_29 jre, it fails, but if I use 1.6.0_29 jdk, it works... I spent about a day trying to figure why eclipse (which was using the jre) was failing while myEclipse (which was using the jdk) was working....
How can a bug be introduced to such a late release ? (I am in the process of making a java production version recommendation).
这里有同样的问题(SQLJDBC4、MsSQL 2008 R2、JDK1.6.0.29),但更新到 1.6.0.30 问题已解决...
所以它应该是 DriverManager 中的一个严重错误1.6.0.29
Same problem here (SQLJDBC4, MsSQL 2008 R2, JDK1.6.0.29), but after updating to 1.6.0.30 problem was solved...
So it should be a critical bug in the DriverManager of 1.6.0.29
升级到 1.6.0_30 也对我有用。微软发布了一份声明,宣布 2012 年第一季度进行修复。看起来这是一个 Java 漏洞 (BEAST)。
Upgrading to 1.6.0_30 also worked for me. Microsoft has released a statement announcing the fix in 2012 Q1. It looks like it's a Java vulnerability (BEAST).
我遇到了完全相同的问题,jBoss 会挂在 driver.getConnection() 上。但是,我使用 jBoss EAP 5.1、java 1.6.0_37x64、Sql Server 2005 和 jtds1.2.5 作为我的 jdbc 驱动程序。
我必须使用的解决办法是启动时的 jvm 设置:-Djsse.enableCBCProtection=false 并解决了这个问题。
我不认为这是一个修复,而是目前的一个解决方法。
我确实发现了一个错误: 7105007 : Microsoft & jTDS JDBC 驱动程序在更新到 1.6.0_29 后损坏,非常相似,但原因不同。有趣的是它出现在 MS 驱动程序和 jtds 驱动程序上。
I had the exact same issue where jBoss would hang on driver.getConnection(). However, I was using jBoss EAP 5.1, java 1.6.0_37x64, Sql Server 2005, and jtds1.2.5 as my jdbc driver.
The work around I had to use was a jvm setting at startup: -Djsse.enableCBCProtection=false and that resolved it.
I don't consider this a fix, but rather a work-around at this point.
I did find a bug: 7105007 : Microsoft & jTDS JDBC driver broken after update to 1.6.0_29 that was very similar, but had a different cause. What was interesting was that it showed up on both the MS drivers and jtds drivers.