UNIX 上与 Oracle DB 的 Java getConnection 崩溃或花费的时间比 Windows 上长得多
我确实有一个大问题!我使用“DriverManager.getConnection(url,properties)”打开与 Oracle 数据库的连接。 在 UNIX 计算机(当前在 VM 上)上,99% 的情况下都会出现问题,函数需要几分钟才能返回连接。我增加了oracle的连接超时,这样我就不会得到SQLException,但是最多需要3分钟才能获得连接。在我的 Windows 机器上,连接会在 1 秒内返回。
telnet 到服务器+端口工作正常,ping 成功,traceroute 看起来不错。我还尝试了多个虚拟机或不同物理机上的不同数据库。
我运行实际的 JDBC 驱动程序“ojdbc6-11.2.0.2.0.jar”。
有人有好主意吗?
I actual have a big problem! I open a connection to a oracle database with "DriverManager.getConnection(url, properties)".
On UNIX machines (currently on a VM), the problem occurs that 99% of the time it needs minutes till the function return a connection. I increased the connection timout of oracle so that I don't get a SQLException, but it needs up to 3 Minutes to get a connection. On my windows machine the connection is returned in under 1 second.
telnet to server + port works, ping is sucessfully, traceroute looks good. I also tried from several VMs or on different databases on different physical machines.
I run the actual JDBC Driver "ojdbc6-11.2.0.2.0.jar".
Does anyone have a good idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过很长一段时间,我们找到了问题所在。 Oracle JDBC 驱动程序在读取唯一 ID 时被阻止。设置 VM 参数
-Djava.security.egd=file:/dev/urandom
后,我们可以保证始终在足够的时间内收到 uniqueid。不幸的是,如果机器有足够的熵,默认的 /dev/random 只会生成一个 uniqueid,而虚拟机上通常会丢失该信息。
也许有一天这会对你们中的一些人有所帮助。
After a long time we figured out the problem. The Oracle JDBC driver blocked at the point where a unique id was read. After setting the VM Argument
-Djava.security.egd=file:/dev/urandom
we could gurantee to always receive a uniqueid in an adequate time. The default /dev/random unfortunately just generates a uniqueid if the machine has enough entropy, which is often missing on virtual machines.
Maybe this helps some of you folks one day.
这有点奇怪,但可能是反向 DNS 问题。
如果您的 Oracle 服务器运行在 UNIX 上,请尝试以下操作:
查看两个名称解析是否有不同。如果有,则可能是尝试在 LINUX IP 上进行反向 DNS 查找花费的时间太长。
这事发生在我身上。
It's a little bit strange but it could be a REVERSE DNS problem.
If you Oracle server is on unix, try the following:
See if there is something different on the two name resolutions. If there is, then it might be the case that trying to do a reverse DNS lookup on the LINUX IP is taking too long.
It's happened to me.