Recently, a Java Swing program was written under CentOS and found that the JDBC connection to Oracle in Linux was slow and often failed. But the same program runs very fast under Windows. Online search for a long time and I this situation is not okay, by chance to see the following article:
Original Address http://www.xuebuyuan.com/200181.html
Troubleshoot slow problems with JDBC Connection Orcale April 01, 2012 ⁄ general ⁄ a total of 341 characters ⁄ font size Small medium big ⁄ comments off using the Java Development Program, choose the Ojdbc14.jar driver, connect Oracle, the discovery speed is very slow. Write the test procedure, found that the light to establish the connection will need about 10s. The solution is not to be baffled. Later a colleague used Baidu Dafa to find the answer, the special record is as follows: We are using jdk1.5.0, for the lower version of the jdk1.4 or higher version of the jdk1.5.6 version, there is no problem. It should appear to be a JDK version issue. Later found that jdk.1.5.0 will default to find agents, spending a lot of time, so the code added: import java.net.ProxySelector; Proxyselector.setdefault (null), which masks the choice of proxy servers in jre1.5, using a direct connection. Re-test. Speed 0.4s. By the way despise Sun, own JDK, can not stabilize some, compatibility is better?
However, I am here are jdk1.8, at first did not take the matter, but later did not have a try to carry out the purpose of testing a bit.
mygod! The problem is solved! Keep track of your notes, and treat the same depressed classmates.
Linux (Centos) JDBC connects to Oracle at an ultra-slow speed problem