开发者

Java getConnection to Oracle DB on UNIX crashed or takes much longer than on Windows

开发者 https://www.devze.com 2023-04-03 19:25 出处:网络
I actual have a big problem! I open a connection to a oracle database with \"DriverManager.getConnection(url, properties)\".

I actual have a big problem! I open a connection to a oracle database with "DriverManager.getConnection(url, properties)". On UNIX m开发者_开发百科achines (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?


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.


It's a little bit strange but it could be a REVERSE DNS problem.

If you Oracle server is on unix, try the following:

$ host IP_ADDRESS_OF_WIN_MACHINE
$ host IP_ADDRESS_OF_LINUX_MACHINE

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消