⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 让我感觉很爽的cachedrowset.htm

📁 Sun的高速缓存CachedRowSet方案资料档
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0104)http://www.zaoxue.com/Article/readcourse/bianchengwendang/Java/rangwoganjuehenshuangdeCachedRowSet.shtml -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>让我感觉很爽的CachedRowSet - 编程文档 - Java - www.supcode.com</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META 
content=作者:fbysssBlog:blog.csdn.net/fbysss声明:本文章由fbysss原创,转载或引用请注明引用地址。问题:在DBmanager.java中写了一个getResultSet方法,为的就是不用每次在页面中去释放连接。然而,在不同的操作系统环境下,不一定好使,比如在windows下,ResultSe... 
name=description>
<META content="让我感觉很爽的CachedRowSet - 编程文档 - Java" name=keywords>
<META content=TRUE name=MSSmartTagsPreventParsing>
<META http-equiv=MSThemeCompatible content=Yes><LINK 
href="让我感觉很爽的CachedRowSet.files/style.css" type=text/css rel=stylesheet>
<SCRIPT src="让我感觉很爽的CachedRowSet.files/main.js" type=text/javascript></SCRIPT>

<META content="MSHTML 6.00.2900.3059" name=GENERATOR></HEAD>
<BODY>
<DIV id=globalHeader>
<DIV id=pageHead>
<DIV id=headNav>
<DIV class=headNav><A href="http://www.supcode.com/">首 页</A> ┆ <A 
title=各类源代码下载,asp/php/asp.net/jsp/vb/c/c++等 
href="http://www.zaoxue.com/code/">源码下载</A> ┆ <A title=网页模板,素材等其他模板下载 
href="http://www.zaoxue.com/templatedown/">模板下载</A> ┆ <A 
title=软件下载,各种常用软件行业软件等下载 href="http://www.zaoxue.com/Soft/">软件下载</A> ┆ <A 
title=各类视频,书籍教程下载 href="http://www.zaoxue.com/techdown/">教程下载</A> ┆ <A 
title=硬件驱动下载 href="http://www.zaoxue.com/drivers/">驱动下载</A> ┆ <A title=文章中心 
href="http://www.zaoxue.com/Article/">网络学院</A> ┆ <A 
title=全球最新0DAY破解信息查询,本站不提供软件破解下载 href="http://www.zaoxue.com/nfo/">软件查询</A> ┆ <A 
title=网通,铁通等非电信拥护访问此连接 href="http://www1.supcode.com/">加速镜象站点</DIV></DIV><!-- End #headNav -->
<DIV id=masthead>
<DIV id=siteLogo><A href="http://www.zaoxue.com/"><IMG height=60 
alt="早雪网 http://www.zaoxue.com" src="让我感觉很爽的CachedRowSet.files/logo.gif" 
width=180 border=0></A></DIV>
<DIV id=bannerad>
<SCRIPT language=javascript src="让我感觉很爽的CachedRowSet.files/banner.js"></SCRIPT>
</DIV>
<DIV id=mastheadLinks>
<UL>
  <LI><IMG height=12 src="让我感觉很爽的CachedRowSet.files/top_home.gif" width=13 
  border=0> <A title=将本站设为你的首页 
  onclick="this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.zaoxue.com');return false;" 
  href="http://www.zaoxue.com/">设为首页</A> 
  <LI><IMG height=12 src="让我感觉很爽的CachedRowSet.files/top_gift.gif" width=13 
  border=0> <A title=将本站加入到你的收藏夹 
  href="javascript:window.external.AddFavorite(location.href,document.title)">加入收藏</A> 

  <LI><IMG height=12 src="让我感觉很爽的CachedRowSet.files/top_mail.gif" width=13 
  border=0> <A href="mailto:web@supcode.com">联系我们</A> </LI></UL></DIV></DIV><!-- End #masthead -->
<DIV id=siteNav>
<DIV id=siteNav001></DIV>
<DIV id=siteNav002>
<DIV class=siteNav><A title=站长兵书 
href="http://www.zaoxue.com/Article/readcourse/zhanchangbingshu/">站长兵书</A> | <A 
title=编程文档 
href="http://www.zaoxue.com/Article/readcourse/bianchengwendang/">编程文档</A> | <A 
title=设计学院 
href="http://www.zaoxue.com/Article/readcourse/shejixueyuan/">设计学院</A> | <A 
title=软件教程 
href="http://www.zaoxue.com/Article/readcourse/ruanjianjiaocheng/">软件教程</A> | <A 
title=服务器技术 href="http://www.zaoxue.com/Article/readcourse/fuwuqilei/">服务器类</A> 
| <A title=网络技术 
href="http://www.zaoxue.com/Article/readcourse/wangluojishu/">网络技术</A> | <A 
title=黑客攻防 
href="http://www.zaoxue.com/Article/readcourse/heikegongfang/">黑客攻防</A> | <A 
title=黑客故事 href="http://www.zaoxue.com/Article/readcourse/heikegushi/">黑客故事</A> 
| <A title=破解资讯 
href="http://www.zaoxue.com/Article/readcourse/pojiexiangguan/">破解相关</A> | <A 
title=软件报道 
href="http://www.zaoxue.com/Article/readcourse/ruanjianbaodao/">软件报道</A></DIV></DIV>
<DIV id=siteNav003></DIV></DIV><!-- End #siteNav -->
<DIV id=siteCatalog>
<DIV class=siteCatalog><A title=服务器类 
href="http://www.zaoxue.com/Soft/softdown/fuwuqilei/">服务器类</A> | <A title=网络软件 
href="http://www.zaoxue.com/Soft/softdown/wangluogongju/">网络工具</A> | <A 
title=系统工具 href="http://www.zaoxue.com/Soft/softdown/xitonggongju/">系统工具</A> | 
<A title="应用软件 " 
href="http://www.zaoxue.com/Soft/softdown/yingyongruanjian/">应用软件</A> | <A 
title=联络聊天 href="http://www.zaoxue.com/Soft/softdown/lianluoliaotian/">联络聊天</A> 
| <A title="图形图像 " 
href="http://www.zaoxue.com/Soft/softdown/tuxingtuxiang/">图形图像</A> | <A 
title="多媒体类 " href="http://www.zaoxue.com/Soft/softdown/duomeitilei/">多媒体类</A> | 
<A title=行业软件 
href="http://www.zaoxue.com/Soft/softdown/xingyeruanjian/">行业软件</A> | <A 
title=游戏娱乐 href="http://www.zaoxue.com/Soft/softdown/youxiyule/">游戏娱乐</A> | <A 
title="编程开发 " 
href="http://www.zaoxue.com/Soft/softdown/bianchengkaifa/">编程开发</A> | <A 
title="安全相关 " 
href="http://www.zaoxue.com/Soft/softdown/anquanxiangguan/">安全相关</A></DIV></DIV><!-- End #siteCatalog --></DIV><!-- End #pageHead --></DIV><!-- End #globalHeader -->
<DIV></DIV><!-- End #pageHead -->
<DIV></DIV><!-- End #globalHeader -->
<DIV id=globalBanner>
<DIV id=pageBanner>
<DIV id=frameLoging></DIV>
<DIV id=globalBannerad>
<SCRIPT language=javascript src="让我感觉很爽的CachedRowSet.files/top.js"></SCRIPT>
</DIV></DIV><!-- End #pageBanner --></DIV><!-- End #globalBanner -->
<DIV id=globalPosition>
<DIV id=positionBody>
<DIV id=position><IMG height=13 src="让我感觉很爽的CachedRowSet.files/class_ar.gif" 
width=13> 您当前的位置:<A href="http://www.zaoxue.com/">超级下载</A> → <A 
href="http://www.zaoxue.com/Article/">网络学院</A> → <A 
href="http://www.zaoxue.com/Article/readcourse/bianchengwendang/">编程文档</A> → <A 
href="http://www.zaoxue.com/Article/readcourse/bianchengwendang/Java/">Java</A> 
→ <A 
href="http://www.zaoxue.com/search.asp?word=让我感觉很爽的CachedRowSet&amp;m=1">让我感觉很爽的CachedRowSet</A></DIV></DIV><!-- End #positionBody --></DIV><!-- End #globalPosition -->
<DIV id=globalBody>
<DIV id=pageMain>
<DIV id=mainBody>
<DIV id=indexSearch>
<FORM 
onsubmit="window.location=this.field.options[this.field.selectedIndex].value+this.keyword.value; return false;"><INPUT 
onfocus=this.select(); maxLength=60 size=50 value=请输入关键字 name=keyword> <SELECT 
name=field> <OPTION value=/search.asp?m=2&amp;keyword= selected>下载</OPTION> 
  <OPTION value=/article/search.asp?act=topic&amp;keyword=>文章</OPTION> <OPTION 
  value=/article/search.asp?act=isWeb&amp;keyword=>网页</OPTION></SELECT> <INPUT type=submit value=开始搜索> </FORM></DIV>
<DIV id=mainNewsTitles>
<H1>让我感觉很爽的CachedRowSet</H1></DIV>
<DIV 
class=mainNewsInfo>作者:未知&nbsp;&nbsp;来源:supcode.com收集整理&nbsp;&nbsp;发布时间:2005-6-29 
19:14:51</DIV>
<SCRIPT language=javascript>
			<!--
			var newasp_fontsize=9;
			var newasp_lineheight=12;
			//-->
			</SCRIPT>

<DIV class=mainFontSize>
<P align=right><A title=减小字体 style="CURSOR: hand; POSITION: relative" 
onclick='if(newasp_fontsize>8){NewsContentLabel.style.fontSize=(--newasp_fontsize)+"pt";NewsContentLabel.style.lineHeight=(--newasp_lineheight)+"pt";}'><IMG 
height=15 src="让我感觉很爽的CachedRowSet.files/1.gif" width=15 border=0><FONT 
color=#ff6600>减小字体</FONT></A> <A title=增大字体 
style="CURSOR: hand; POSITION: relative" 
onclick='if(newasp_fontsize<64){NewsContentLabel.style.fontSize=(++newasp_fontsize)+"pt";NewsContentLabel.style.lineHeight=(++newasp_lineheight)+"pt";}'><IMG 
height=15 src="让我感觉很爽的CachedRowSet.files/2.gif" width=15 border=0><FONT 
color=#ff6600>增大字体</FONT></A> </P></DIV>
<DIV class=mainNewsContent>
<DIV class=GgAdwz></DIV>
<DIV class=NewsContent id=NewsContentLabel>
<P><FONT 
color=#800080>作者:fbysss<BR>Blog:blog.csdn.net/fbysss<BR>声明:本文章由fbysss原创,转载或引用请注明引用地址。</FONT></P>
<P><FONT 
color=#000000><B>问题</B>:在DBmanager.java中写了一个getResultSet方法,为的就是不用每次在页面中去释放连接。然而,在不同的操作系统环境下,不一定好使,比如在windows下,ResultSet是可以脱离connection继续使用的,但linux下就不行。如果要修改为Collection所有的页面都要进行修改,其改动量可想而知,这是我及其不愿意看到的。<BR>怎么办?<BR>幸好,我查到了CachedRowSet。是它救了我。<BR>最棒的是,CachedRowSet继承自ResultSet,我只需要修改核心方法,页面一点不用改动!<BR><B>代码</B>:<BR></FONT><FONT 
color=#0000ff>&nbsp;&nbsp; /**<BR>&nbsp;&nbsp;&nbsp;&nbsp; * 
获取<BR>&nbsp;&nbsp;&nbsp;&nbsp; * @return ResultSet<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
*/<BR>&nbsp;&nbsp;&nbsp; //public ResultSet getResultSet(String _sSQL) throws 
Exception {<BR>&nbsp;&nbsp;&nbsp; public ResultSet getResultSet(String _sSQL) 
throws Exception {</FONT></P>
<P><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("-------返回数据集-------rowset1.0");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Connection vConn = 
getConnection();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
/*PreparedStatement pstmt = 
vConn.prepareStatement(_sSQL,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ResultSet.TYPE_SCROLL_SENSITIVE, 
ResultSet.CONCUR_READ_ONLY);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ResultSet rs = 
pstmt.executeQuery();*/<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
CachedRowSet crs = new CachedRowSetImpl();</FONT></P>
<P><FONT 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -