免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1038 | 回复: 0
打印 上一主题 下一主题

jdk1.5.0 + tomcat5.5.x连接获取数据库连接比较慢问题解决 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-06 11:00 |只看该作者 |倒序浏览
    最近将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
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP