- 论坛徽章:
- 0
|
最近将jdk1.4.x + tomcat4.x下的升级到jdk1.5.0 + tomcat5.5.x后,发现在某些机器下获取数据库连接特别的慢,经过在网上所索终于找到的解决方法,就是在获得数据库的连接前执行ProxySelector的ProxySelector.setDefault(null);方法即可解决上述问题。
参考资料:
Topic: Why Is oracle.jdbc.OracleDriver So Much Slower In 1.5 Than 1.4?
My db is Oracle9i Enterprise Edition Release 9.0.1.3.0, and the ojdbc14.jar is in my class path - just like it was when I was using 1.4.
[img]mhtml:file://F:\soft\资料\文章收集\J2SE5[1].0新特性之使用代理服务器\J2SE5.0新特性之使用代理服务器\JavaRanch%20Big%20Moose%20Saloon_%20Why%20Is%20oracle.jdbc.OracleDriver%20So%20Much%20Slower%20In%201.5%20Than%201.4_.mht!cid:000e01c658c4$ea1f52a0$_CDOSYS2.0[/img]
C:\my_javas>java -version
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode)
C:\my_javas>
Thanks for any hints as to how I can get back the same performance I had with 1.4, because it is taking 3-5 times longer
[img]mhtml:file://F:\soft\资料\文章收集\J2SE5[1].0新特性之使用代理服务器\J2SE5.0新特性之使用代理服务器\JavaRanch%20Big%20Moose%20Saloon_%20Why%20Is%20oracle.jdbc.OracleDriver%20So%20Much%20Slower%20In%201.5%20Than%201.4_.mht!cid:000f01c658c4$ea1f52a0$_CDOSYS2.0[/img]
with 1.5 .
Never mind! I found the answer!
[img]mhtml:file://F:\soft\资料\文章收集\J2SE5[1].0新特性之使用代理服务器\J2SE5.0新特性之使用代理服务器\JavaRanch%20Big%20Moose%20Saloon_%20Why%20Is%20oracle.jdbc.OracleDriver%20So%20Much%20Slower%20In%201.5%20Than%201.4_.mht!cid:001001c658c4$ea1f52a0$_CDOSYS2.0[/img]
It seems there is a default proxy server in the 1.5 jre that needs to be disabled
[img]mhtml:file://F:\soft\资料\文章收集\J2SE5[1].0新特性之使用代理服务器\J2SE5.0新特性之使用代理服务器\JavaRanch%20Big%20Moose%20Saloon_%20Why%20Is%20oracle.jdbc.OracleDriver%20So%20Much%20Slower%20In%201.5%20Than%201.4_.mht!cid:001101c658c4$ea1f52a0$_CDOSYS2.0[/img]
Please see
http://forum.java.sun.com/thread.jspa?messageID=3491747
which partially reads:
**************************
The resolution of this is to turn off the new proxy server feature in JRE1.5. You do this by informing the jre that you do not have a default proxy server. This is done with the following lines of code placed somewhere in your application:
import java.net.ProxySelector;
.
.
ProxySelector.setDefault(null);
With this, the NetBIOS name queries do not emanate, and we revert back to the 1.4 behavior.
Mauro Zallocco.
**************************
Thanks so much to Mauro!
[img]mhtml:file://F:\soft\资料\文章收集\J2SE5[1].0新特性之使用代理服务器\J2SE5.0新特性之使用代理服务器\JavaRanch%20Big%20Moose%20Saloon_%20Why%20Is%20oracle.jdbc.OracleDriver%20So%20Much%20Slower%20In%201.5%20Than%201.4_.mht!cid:001201c658c4$ea1f52a0$_CDOSYS2.0[/img]
[ January 28, 2006: Message edited by: Bob Nedwor ]
More information please see:
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16991/showart_95924.html |
|