??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲电影日韩精品,国产亚洲大尺度无码无码专线 ,亚洲综合在线观看视频http://m.tkk7.com/cyicecream/category/3396.html气质源于知识zh-cnFri, 06 May 2011 07:11:15 GMTFri, 06 May 2011 07:11:15 GMT60国外java开源网站聚?转蝲)http://m.tkk7.com/cyicecream/archive/2011/05/05/349603.htmlceaboatceaboatThu, 05 May 2011 07:31:00 GMThttp://m.tkk7.com/cyicecream/archive/2011/05/05/349603.htmlhttp://m.tkk7.com/cyicecream/comments/349603.htmlhttp://m.tkk7.com/cyicecream/archive/2011/05/05/349603.html#Feedback0http://m.tkk7.com/cyicecream/comments/commentRss/349603.htmlhttp://m.tkk7.com/cyicecream/services/trackbacks/349603.htmlsourceforge http://www.sourceforge.net
java.net http://www.java.net

www.eclipse.org

www.opensource.org

Lomboz http://www.objectlearn.com/index.jsp (J2EE plugin for Eclipse)
htmlArea http://sourceforge.net/projects/itools-htmlarea/ (所见即所得的在线HTML~辑?
XmlBuddy http://www.xmlbuddy.com/ (XML Editor plugin for Eclipse)
JFreeChart http://www.jfree.org/ (用于生成图表的项?
EclipseME http://eclipseme.sourceforge.net/ (J2ME Developmnt Plugin for Eclipse)
mvnForum http://sourceforge.net/projects/mvnforum/ (论坛)
jChatBox http://www.javazoom.net/index.shtml (用servlet实现的WEB聊天引擎)
POI http://jakarta.apache.org/poi/index.html (用于处理Excel,WORD{文的目)
FileUpload http://jakarta.apache.org/commons/fileupload/ (用于处理HTTP文g上传得项?
PDFBox http://sourceforge.net/projects/pdfbox/ (处理PDF文的项?
Lucene http://jakarta.apache.org/lucene/index.html (搜烦引擎)
Digester http://jakarta.apache.org/commons/digester/ (处理XML信息的项?
DBCP http://jakarta.apache.org/commons/dbcp/ (数据库连接池)
AXIS http://ws.apache.org/axis/ (WebService 的实现框?
Jetspeed http://portals.apache.org/jetspeed-1/ (Portal)
HSQLDB http://sourceforge.net/projects/hsqldb/ (Im memory Database Engine)
CEWOLF http://sourceforge.net/projects/cewolf/ (一套标{ֺ实现Web报表,使用的是jFreeChart引擎)
Struts Menu http://sourceforge.net/projects/struts-menu/ (ZStruts的Web菜单目)
htmlparser http://sourceforge.net/projects/htmlparser/ (用于解析HTML信息的项?
Mondrian http://sourceforge.net/projects/mondrian/(Open Source OLAP Database)
ProGuard http://sourceforge.net/projects/proguard/(Java的؜淆器)
InfoGlue http://sourceforge.net/projects/infoglue/ (J2EE 内容理pȝ)
JPivot http://sourceforge.net/projects/jpivot/ (ZWEB的OLAP 展现)
http://java-source.net/

http://www.javaalmanac.com - Java开发者年鉴一书的在线版本. 要想快速查到某UJava技巧的用法及示例代? q是一个不错的d.
http://www.onjava.com - O'Reilly的Java|站. 每周都有新文?
http://java.sun.com - 官方的Java开发者网?- 每周都有新文章发?
http://www.developer.com/java - 由Gamelan.com l护的Java技术文章网?
http://www.java.net - Sun公司l护的一个JavaC֌|站.
http://www.builder.com - Cnet的Builder.com|站 - 所有的技术文? 以JavaZ.
http://www.ibm.com/developerworks/java - IBM的Developerworks技术网? q是其中的Java技术主?
http://www.javaworld.com - 最早的一个Java站点. 每周更新Java技术文?
http://www.devx.com/java - DevXl护的一个Java技术文章网?
http://www.fawcette.com/javapro - JavaPro在线杂志|站.
http://www.sys-con.com/java - Java Developers Journal的在U杂志网?
http://www.javadesktop.org - 位于Java.net的一个Java桌面技术社区网?
http://www.theserverside.com - q是一个讨论所有Java服务器端技术的|站.
http://www.jars.com - 提供Java评论服务. 包括各种framework和应用程?
http://www.jguru.com - 一个非常棒的采用Q&A形式的Java技术资源社?
http://www.javaranch.com - 一个论坛,得到Java问题{案的地方,初学者的好去处?br /> http://www.ibiblio.org/javafaq/javafaq.html - comp.lang.java的FAQ站点 - 攉了来自comp.lang.java新闻l的问题和答案的分类目录.
http://java.sun.com/docs/books/tutorial/ - 来自SUN公司的官方Java指南 - 对于了解几乎所有的java技术特性非常有帮助.
http://www.javablogs.com - 互联|上最z跃的一个Java Blog|站.
http://java.about.com/ - 来自About.com的Java新闻和技术文章网?/div> HttpClient http://jakarta.apache.org/commons/httpclient/ 处理http客户端的接口

原文地址
http://blog.csdn.net/Xviewee/archive/2007/12/17/1944374.aspx

ceaboat 2011-05-05 15:31 发表评论
]]>WAS部v中遇到的问题http://m.tkk7.com/cyicecream/archive/2006/01/25/29202.htmlceaboatceaboatWed, 25 Jan 2006 07:09:00 GMThttp://m.tkk7.com/cyicecream/archive/2006/01/25/29202.htmlhttp://m.tkk7.com/cyicecream/comments/29202.htmlhttp://m.tkk7.com/cyicecream/archive/2006/01/25/29202.html#Feedback0http://m.tkk7.com/cyicecream/comments/commentRss/29202.htmlhttp://m.tkk7.com/cyicecream/services/trackbacks/29202.html现象一Q?BR>         错误信息Q?BR>                 java.lang.SecurityException: sealing violation: can't seal package oracle.jdbc.driver: already loaded
         原因Q?BR>                 was启动的lib里存在多个ORACLE DRIVER?BR>         解决Q?BR>                 保留最新的一个驱动包解决?BR>         遗留问题Q?BR>                 开发环境用TOMCAT发布无此问题QJBUILDER2006开发中包是有优先顺序的Q即使存在多?BR>         相同的类Q优先选择W一个找到的cRWAS在这斚w昄存在不Q排异容错性不够强大?BR>现象二:
        错误信息Q?BR>               
Error 500: LinkageError while defining class: com.gzedu.eecn.structure.login.action.UserLoginAction Could not be defined due to: com/gzedu/eecn/structure/login/action/UserLoginAction (Illegal constant pool type) This is often caused by having a class defined at multiple locations within the classloader hierarchy. Other potential causes include compiling against an older or newer version of the class that has an incompatible method signature. Dumping the current context classloader
      
原因Q?BR>                 上传的文件已l损坏。重复试q很多次Q发现本机器通过SSH上传q程中文件已l损坏?BR>         属于本机问题?BR>        解决Q?BR>               通过同事的机器上传文件解?BR>        ȝQ?BR>                cM此问题出现的几率很小Q可以认为是相同的环境,使用相同的方式做一件事情也有可能出?BR>       不同的效果。再ơ出现类似问题可以更快的定位错误炏V?BR>现象三:
        错误信息Q?BR>                  com.ibm.ws.jsp.translator.JspTranslationException: JSPG0227E: 转换 /login.jsp: 
/login.jsp(1,1) --> JSPG0145E: 未知 JSP 元素Qjsp:directive.pagelanguage
         原因Q?BR>                  windows环境、tomcat作ؓ服务器开发,部v到sit、unix环境Q会出现面不同的开发环境会
         有中文问题,或是说重复定义encoding的问题页面编码问题?BR>         解决Q?BR>            按照如下q行修改和配|;
                     
1. 对于不是被include的页面必M用;
               <%@ page contentType="text/html;charset=GBK" pageEncoding="GBK" language="java" %>
               ?大写GBK
                     2. 对于被Include的页面必M用如下;
               ?lt;%@ page pageEncoding="GBK" language="java" %>
             注:在TOMCAT4.1.30-->was5.0,6.0出现此问?BR>        



ceaboat 2006-01-25 15:09 发表评论
]]>
关于CachedRowSethttp://m.tkk7.com/cyicecream/archive/2005/12/09/23075.htmlceaboatceaboatFri, 09 Dec 2005 01:57:00 GMThttp://m.tkk7.com/cyicecream/archive/2005/12/09/23075.htmlhttp://m.tkk7.com/cyicecream/comments/23075.htmlhttp://m.tkk7.com/cyicecream/archive/2005/12/09/23075.html#Feedback0http://m.tkk7.com/cyicecream/comments/commentRss/23075.htmlhttp://m.tkk7.com/cyicecream/services/trackbacks/23075.html据说sun对LOG的支持原来是2GQ不晓得是否有支?G的类?BR>
对于原来使用的com.sun.rowset.CachedRowSetImpl深感疑惑此类在缓存number字段的时候如果SCALE没声明会报不能小?的异?img src ="http://m.tkk7.com/cyicecream/aggbug/23075.html" width = "1" height = "1" />

ceaboat 2005-12-09 09:57 发表评论
]]>
点点滴滴http://m.tkk7.com/cyicecream/archive/2005/11/23/21131.htmlceaboatceaboatWed, 23 Nov 2005 07:31:00 GMThttp://m.tkk7.com/cyicecream/archive/2005/11/23/21131.htmlhttp://m.tkk7.com/cyicecream/comments/21131.htmlhttp://m.tkk7.com/cyicecream/archive/2005/11/23/21131.html#Feedback0http://m.tkk7.com/cyicecream/comments/commentRss/21131.htmlhttp://m.tkk7.com/cyicecream/services/trackbacks/21131.html2.websphere5?的区别:5对\径不需?Q?必须?Q否则因为少?找不到相应的配置文g


ceaboat 2005-11-23 15:31 发表评论
]]>
多注意一些细?/title><link>http://m.tkk7.com/cyicecream/archive/2005/11/09/19038.html</link><dc:creator>ceaboat</dc:creator><author>ceaboat</author><pubDate>Wed, 09 Nov 2005 12:17:00 GMT</pubDate><guid>http://m.tkk7.com/cyicecream/archive/2005/11/09/19038.html</guid><wfw:comment>http://m.tkk7.com/cyicecream/comments/19038.html</wfw:comment><comments>http://m.tkk7.com/cyicecream/archive/2005/11/09/19038.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/cyicecream/comments/commentRss/19038.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/cyicecream/services/trackbacks/19038.html</trackback:ping><description><![CDATA[通过URL来访问网站,action里request.getMothod()得到的GET.<BR>而通过FORM来提交的则可以设|POSTQ可以通过q两U方<BR>式的差异来做一些第一ơ访问与之后讉K的一些个性化讄?img src ="http://m.tkk7.com/cyicecream/aggbug/19038.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/cyicecream/" target="_blank">ceaboat</a> 2005-11-09 20:17 <a href="http://m.tkk7.com/cyicecream/archive/2005/11/09/19038.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CachedRowSet http://m.tkk7.com/cyicecream/archive/2005/10/01/14582.htmlceaboatceaboatSat, 01 Oct 2005 04:54:00 GMThttp://m.tkk7.com/cyicecream/archive/2005/10/01/14582.htmlhttp://m.tkk7.com/cyicecream/comments/14582.htmlhttp://m.tkk7.com/cyicecream/archive/2005/10/01/14582.html#Feedback0http://m.tkk7.com/cyicecream/comments/commentRss/14582.htmlhttp://m.tkk7.com/cyicecream/services/trackbacks/14582.html

ceaboat 2005-10-01 12:54 发表评论
]]>
影响性能的测试报告(数据库版Q测试源代码http://m.tkk7.com/cyicecream/archive/2005/09/26/14152.htmlceaboatceaboatMon, 26 Sep 2005 14:36:00 GMThttp://m.tkk7.com/cyicecream/archive/2005/09/26/14152.htmlhttp://m.tkk7.com/cyicecream/comments/14152.htmlhttp://m.tkk7.com/cyicecream/archive/2005/09/26/14152.html#Feedback0http://m.tkk7.com/cyicecream/comments/commentRss/14152.htmlhttp://m.tkk7.com/cyicecream/services/trackbacks/14152.html                                                          试源代?/FONT>

CapabilityForConnection 主运行程序,d配置文ginit.properties、reference.properties初始化参数。调?FONT color=#000000>POOLTESTQ一ơ完整的试用例Q,计算其^均时间与使用q接?/FONT>

package com.cea.repository.test;

import
 org.apache.commons.logging.LogFactory;
import
 org.apache.commons.logging.Log;
import
 java.util.Properties;
import
 java.io.FileInputStream;
import
 java.io.InputStream;

public class
 CapabilityForConnection {
    
private static Log log = LogFactory.getLog(CapabilityForConnection.class
);
    
/**

     * 计算一ơ测试所消耗的旉
     
*/
    
public static long times = 0;
    
/**

     * q接?BR>     
*/
    
public static long psize = 0;

    
public static void main(String[] args) throws
 Exception {
        
/**

         * q行的次?BR>         
*/
        
int size = 1;
        
/**

         * 见POOLTEST说明
         
*/
        
int execsum = 0;
        
/**

         * 见POOLTEST说明
         
*/
        
int opencon = 0;
        
/**

         * execsum对应properties的命?BR>         
*/
        String execs 
= null;
        
/**

         * opencon对应properties的命?BR>         
*/
        String openc 
= null;

        
long sumtime = 0
;
        Properties prop 
= initProperty("reference.properties"
);
        Properties init 
= initProperty("init.properties"
);

        
if (init.size() > 0
) {
            Object o 
= init.get("init"
);
            size 
=
 Integer.parseInt(o.toString());
            execs 
= init.get("name0"
).toString();
            openc 
= init.get("name1"
).toString();
        }

        
for (int i = 0; i < prop.size() / 2; i++
) {
            execsum 
= Integer.parseInt(prop.getProperty(execs +
 i).toString());
            opencon 
= Integer.parseInt(prop.getProperty(openc +
 i).toString());
            sumtime 
= 0
;
            psize 
= 0
;
            log.info(
"W?/SPAN>" + (i + 1+ "l数?"
);
            log.info(
"q发应用敎ͼ" + execsum + " 模拟q接敎ͼ" +
 opencon);

            String[] reference 
= {"" + execsum, "" +
 opencon};
            
for (int j = 0; j < size; j++
) {
                times 
= 0
;
                PoolTest.main(reference);
                sumtime 
+=
 times;
            }
            log.info(
"W?/SPAN>" + (i + 1+ "l数据共执行" + size + "?q_耗时为:" +

                     sumtime 
/ (size * execsum) + "毫秒");
            log.info(
"q_使用" + psize / size + "个连?/SPAN>"
);

        }
    }

    
private static Properties initProperty(String filename) throws
 Exception {
        InputStream is 
= new
 FileInputStream(filename);
        Properties prop 
= new
 Properties();
        prop.load(is);
        
return
 prop;

    }
}

POOLTEST计算一ơ完整过E耗时Q统计消耗的q接
package com.cea.repository.test;

import
 com.cea.repository.test.testdata.MainExecute;
import
 java.util.HashMap;
import
 java.util.Map;
import
 com.cea.repository.connection.PoolSupper;
import
 org.apache.commons.logging.LogFactory;
import
 org.apache.commons.logging.Log;
/**

 *
 * 

Title: q接池性能试


 *
 * 

Description: 试不合理的利用q接对WEB应用所造成影响.


 *
 * 

Copyright: Copyright (c) 2005


 *
 * 

Company: 


 *
 * 
@author 舟
 * 
@version
 1.0
 
*/

public class PoolTest extends Thread {
    
private static Log log = LogFactory.getLog(PoolTest.class
);
    
/**

     * q发执行MainExecute的数?BR>     
*/
    
private static int EXECUTESUM = 35;
    
/**

     * 一ơMainExecute执行所h的连接数
     
*/
    
public static int CONNECTIONS = 3;
    
/**

     * 记录所使用的连?BR>     
*/
    
public static Map poolTestMap = new HashMap();
    
/**

     * Wsumơ执行MainExecute所需要的旉
     
*/
    
public int sum = 0;

    
public void
 run() {
        
try
 {
            
long s =
 System.currentTimeMillis();
            com.cea.repository.test.testdata.MainExecute.main(
null
);
            
long t = System.currentTimeMillis() -
 s;
            CapabilityForConnection.times 
+=
t;
//
            if(CapabilityForConnection.times < t){
//
                CapabilityForConnection.times = t;
//
            }

//
            log.info("time" + (++sum) + ":" +
//                               (System.currentTimeMillis() - s));

        } catch (Exception ex) {
        }
    }

    
public static void main(String[] args) throws
 Exception {
        
if(args!= null && args.length>1
){
            EXECUTESUM 
= Integer.parseInt(args[0
]);
            CONNECTIONS 
= Integer.parseInt(args[1
]);
        }

        PoolSupper.initPool();
        startExec(EXECUTESUM);
        
//讑֮_长的旉{待所有程序执行完Q得到准的q发执行所消耗的旉

        try {
            Thread.sleep(
6000
);
        } 
catch
 (InterruptedException ex) {
            ex.printStackTrace();
        }
        log.info(
"q行q_耗时Q?/SPAN>" + CapabilityForConnection.times/
EXECUTESUM);
        
//如果条g成立Q证明连接没有被回收Q只要存在一个相同的Q就证明q接被重复利用了

        CapabilityForConnection.psize +=poolTestMap.size();
        
if (poolTestMap.size() ==
 EXECUTESUM) {
            log.info(
"不存在重复用的q接Q共创徏" + poolTestMap.size()+ "个连?/SPAN>"
 );
        } 
else
 {
            log.info(
"׃?/SPAN>" + poolTestMap.size()+ "个连?/SPAN>"
 );
        }
        clear();
    }

    
private static void startExec(int
 EXECUTESUM) {
        
int i = 0
;
        
while (i <
 EXECUTESUM) {
            
if (i++ <
 EXECUTESUM) {
                
try
 {
                    
new
 PoolTest().start();
                } 
catch
 (Exception ex2) {
                }
            }
        }
    }
    
private static void
 clear() {
        poolTestMap 
= new
 HashMap();
    }


}

单的不能再简单的试代码Q?BR>
package com.cea.repository.test.testdata;

import
 com.cea.repository.connection.drive.ConnectionFactory;
import
 java.sql.Connection;
import
 java.sql.Statement;
import
 java.sql.ResultSet;
import
 java.sql.PreparedStatement;
import
 java.util.HashMap;
import
 java.util.Map;
import
 java.util.List;
import
 java.util.ArrayList;
import
 com.cea.repository.test.PoolTest;
import
 com.cea.repository.connection.poolpository.PoolFactory;

/**

 * 
 * 

Title: 


 * 

Description: 


 * 

Copyright: Copyright (c) 2004


 * 

Company: cea


 * 
@author 舟
 * 
@version
 1.0
 
*/

public class MainExecute {
    
public static void main(String[] args) throws
 Exception {
       testConnection();
    }

    
static void testConnection() throws
 Exception {
        
for (int i = 0; i < PoolTest.CONNECTIONS; i++
) {
            Connection con 
=
 PoolFactory.newInstance();
            
//q里的改变直接媄响连接的复用

            Thread.sleep(50);
            PoolTest.poolTestMap.put(con.toString(), 
""
);
            con.close();
        }
    }

}

三个配置文g的内容:
init.properties文g
#q行的次?BR>init=5
#q发执行MainExecute的数量所匚w的名?BR>name0
=execsum
#一ơMainExecute执行所h的连接数所匚w的名?BR>name1
=opencon

reference.properties文g
#qo数据
execsum0
=10

opencon0
=1
#W一ơ测试数?BR>execsum1
=100
opencon1
=6
#W二ơ测试数?BR>execsum2
=85
opencon2
=9
#W三ơ测试数?BR>execsum3
=140
opencon3
=3

最后一个是pool-config.xml数据源配|:
xml version="1.0" encoding="GB2312"?>
<DataResources>
  
<ResourceParams dateIndentity="boat1">
    
<defaultAutoCommit>falsedefaultAutoCommit>
    
<initialSize>30initialSize>
    
<maxActive>40maxActive>
    
<minIdle>0minIdle>
    
<maxIdle>18maxIdle>
    
<maxWait>10000maxWait>
    
<username>forumusername>
    
<password>kingpassword>
    
<driverClassName>oracle.jdbc.driver.OracleDriverdriverClassName>
    
<url>jdbc:oracle:thin:@192.168.1.3:1521:gzesturl>
    
<removeAbandoned>trueremoveAbandoned>
    
<removeAbandonedTimeout>10removeAbandonedTimeout>
    
<logAbandoned>truelogAbandoned>
  
ResourceParams>
DataResources>


ceaboat 2005-09-26 22:36 发表评论
]]>
影响性能的测试报告(数据库版Q?/title><link>http://m.tkk7.com/cyicecream/archive/2005/09/25/14000.html</link><dc:creator>ceaboat</dc:creator><author>ceaboat</author><pubDate>Sun, 25 Sep 2005 09:21:00 GMT</pubDate><guid>http://m.tkk7.com/cyicecream/archive/2005/09/25/14000.html</guid><wfw:comment>http://m.tkk7.com/cyicecream/comments/14000.html</wfw:comment><comments>http://m.tkk7.com/cyicecream/archive/2005/09/25/14000.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://m.tkk7.com/cyicecream/comments/commentRss/14000.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/cyicecream/services/trackbacks/14000.html</trackback:ping><description><![CDATA[<H1 style="MARGIN: 17pt 0cm 16.5pt"><SPAN style="FONT-SIZE: 22pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">         影响性能的测试报告(数据库版Q?/SPAN></H1> <H1 style="MARGIN: 17pt 0cm 16.5pt"><SPAN style="FONT-SIZE: 22pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"></SPAN><A name=_Toc115427584><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">引言</SPAN></A><SPAN style="mso-bookmark: _Toc115427584"></SPAN><SPAN lang=EN-US style="mso-font-kerning: 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></H1> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如需转蝲Q请?A href="mailto:cyicecream@163.com">W?/A>联系<BR></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"> </P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">前提Q项目组里无用到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SPRING</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行事务的管理。项目里以功能划分到每个人手里,</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 32.25pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">形成?/SPAN><SPAN lang=EN-US><FONT face="Times New Roman">BO</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q?/SPAN><SPAN lang=EN-US><FONT face="Times New Roman">DAO</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q?/SPAN><SPAN lang=EN-US><FONT face="Times New Roman">ACTION</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q?/SPAN><SPAN lang=EN-US><FONT face="Times New Roman">VIEW</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">都是单h负责。在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">DAO</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中每个动作都?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt">      闭式的形式存在?/P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">问题Q造成事务的不q诏性。功能是做出来了Q性能问题q早暴露?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">试Q主要针对程序频J请求数据库q接?/SPAN><SPAN lang=EN-US><FONT face="Times New Roman">WEB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用所造成影响做一个测试?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"> <o:p></o:p></FONT></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"> <o:p></o:p></FONT></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt">先做必要的说明,一步步引入正题Q先从性能瓉开始:</SPAN></SPAN></SPAN></P> <H1 style="MARGIN: 17pt 0cm 16.5pt"><A name=_Toc115427585><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">性能瓉</SPAN></A><SPAN style="mso-bookmark: _Toc115427585"></SPAN><SPAN lang=EN-US style="mso-font-kerning: 0pt"><o:p></o:p></SPAN></H1> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">所有的应用E序都存在性能瓉Qؓ了提高应用程序的性能Q就要尽可能的减程序的瓉。以下是?SPAN lang=EN-US>JAVAE序中经常存在的性能瓉?o:p></o:p></SPAN></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><IMG height=154 alt=pingjing.jpg src="http://m.tkk7.com/images/blogjava_net/cyicecream/pingjing.jpg" width=515 border=0><BR>了解了这些瓶颈后Q就可以有针Ҏ的减少q些瓉Q从而提?SPAN lang=EN-US>JAVA应用E序的性能<o:p></o:p></SPAN></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> <o:p></o:p></SPAN></P> <H1 style="MARGIN: 17pt 0cm 16.5pt"><A name=_Toc115427586><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">数据库连接池工作原理</SPAN></A><SPAN style="mso-bookmark: _Toc115427586"></SPAN><SPAN lang=EN-US style="mso-font-kerning: 0pt"><o:p></o:p></SPAN></H1> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">关于q接池的实现原理试ҎQ?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">l过资料的收集与</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">APACHE DBCP</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">里连接池的查阅,对现有的q接池工?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">原理有两U方式:</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; TEXT-ALIGN: left; mso-list: l4 level1 lfo3; tab-stops: list 21.0pt" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt">1.<SPAN style="FONT: 7pt 'Times New Roman'">        </SPAN></SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数据库预先设|配|好的连接数。待得到用户hq接Q传Z个连接,而后Z保持供应数再提前创徏q接Q即提前预备q接Ch。比如:</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-ALIGN: left" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">5</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个通行道代表最大激zȝq接敎ͼ最?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">2</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个闲|连接数。也是说连接池里始l预备了</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">2</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个可随时提供的连接,q接的创建开销是比较大的,q接池的存在是了能够最化的解军_建所{待的时间?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">  </SPAN></SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">1<SPAN style="mso-tab-count: 1">     </SPAN><SPAN style="mso-tab-count: 1">       </SPAN>O<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">  </SPAN>2<SPAN style="mso-tab-count: 1">     </SPAN><SPAN style="mso-tab-count: 1">       </SPAN>O<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">  </SPAN>3<SPAN style="mso-tab-count: 1">     </SPAN><SPAN style="mso-tab-count: 1">       </SPAN>*<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">  </SPAN>4<SPAN style="mso-tab-count: 1">     </SPAN><SPAN style="mso-tab-count: 1">       </SPAN>*<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">  </SPAN>5<SPAN style="mso-tab-count: 1">     </SPAN><SPAN style="mso-tab-count: 1">       </SPAN>*<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">  </SPAN></SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如上图,?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">1</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分配出去时由于池中连接数剩一个,Z持最闲|,会自动创Z个新的连接以防止再次h{待创徏的时间。这L实减了{待的时_但是数据库创建的开销斚wq未得到解决。如果把</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">1-5</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">比喻成汽车,那么q种情况下每量R都是一ơ性用?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">1</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">被请求后下一个连接将?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">6</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来接ѝ那么如何能够重复利?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">1</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">减少数据库开销。于是引出第二种方式?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; TEXT-ALIGN: left; mso-list: l4 level1 lfo3; tab-stops: list 21.0pt" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt">2.<SPAN style="FONT: 7pt 'Times New Roman'">        </SPAN></SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">回收使用完后的连接,攑֛到池中进行@环利用。这么做必须能保?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">2</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">   </SPAN></SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">.<SPAN style="mso-spacerun: yes">  </SPAN></SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使连接能够保持有效的回收?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">   </SPAN></SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">.<SPAN style="mso-spacerun: yes">  </SPAN></SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">U束使用者用释攄动作Q而不是直接把q接</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">close.<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">本h使用的是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">APACHE DBCP</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt">BasicDataSource</SPAN><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的连接池基本实现Q?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">l过代码与测试结果显C,其工作方式是Z二的?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left" align=left><SPAN lang=EN-US style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></P> <H1 style="MARGIN: 17pt 0cm 16.5pt"><A name=_Toc115427587><SPAN lang=EN-US>BasicDataSource</SPAN></A><SPAN style="mso-bookmark: _Toc115427587"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">试用例</SPAN></SPAN><SPAN style="mso-bookmark: _Toc115427587"></SPAN><SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></H1> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">L</SPAN><SPAN lang=EN-US><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><A href="http://m.tkk7.com/cyicecream/cyicecream/cyicecream/cyicecream/archive/2005/09/26/14152.html">试用例</A></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><BR><BR>试l果Q?/SPAN><BR></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><BR>W?/SPAN><SPAN lang=EN-US>2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">l数?/SPAN><SPAN lang=EN-US>:</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q发应用敎ͼ</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">100 </SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模拟q接敎ͼ</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">6<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>2956</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>51</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>3391</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>52</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>2616</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>47</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>3377</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>41</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>3673</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>46</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">W?/SPAN><SPAN lang=EN-US style="COLOR: #ff6600">2</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">l数据共执行</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">5</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US style="COLOR: #ff6600">;</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q_耗时为:</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">3229</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">毫秒</SPAN><SPAN lang=EN-US style="COLOR: #ff6600"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q_使用</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">47</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US> <o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">W?/SPAN><SPAN lang=EN-US>3</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">l数?/SPAN><SPAN lang=EN-US>:</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q发应用敎ͼ</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">85 </SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模拟q接敎ͼ</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">9<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>4830</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>53</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>3247</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>49</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>4116</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>40</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>4070</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>43</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>4053</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>54</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">W?/SPAN><SPAN lang=EN-US style="COLOR: #ff6600">3</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">l数据共执行</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">5</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US style="COLOR: #ff6600">;</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q_耗时为:</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">4063</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">毫秒</SPAN><SPAN lang=EN-US style="COLOR: #ff6600"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q_使用</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">47</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN><SPAN lang=EN-US style="COLOR: #ff6600"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US> <o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">W?/SPAN><SPAN lang=EN-US>4</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">l数?/SPAN><SPAN lang=EN-US>:</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q发应用敎ͼ</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">140 </SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模拟q接敎ͼ</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">3<o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>2076</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>47</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>3104</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>51</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>2048</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>43</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>2421</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>50</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q行q_耗时Q?/SPAN><SPAN lang=EN-US>2751</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">׃?/SPAN><SPAN lang=EN-US>50</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">W?/SPAN><SPAN lang=EN-US style="COLOR: #ff6600">4</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">l数据共执行</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">5</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US style="COLOR: #ff6600">;</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q_耗时为:</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">2480</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">毫秒</SPAN><SPAN lang=EN-US style="COLOR: #ff6600"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">q_使用</SPAN><SPAN lang=EN-US style="COLOR: #ff6600">48</SPAN><SPAN style="COLOR: #ff6600; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个连?/SPAN><SPAN lang=EN-US style="COLOR: #ff6600"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="COLOR: #ff6600"> <o:p></o:p></SPAN></P><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">每次试的结果都可能不同Q但是所得到的结论是一致的。数据显CZ合理的请求用连接严重的影响应用所能承受的q发数量Q响应的旉也因此受到媄响?/SPAN><SPAN lang=EN-US style="COLOR: black"><o:p></o:p></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></SPAN><SPAN lang=EN-US style="COLOR: black"><o:p></o:p></SPAN> </P> <H1 style="MARGIN: 17pt 0cm 16.5pt"><A name=_Toc115427588><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">目前普遍存在的问?/SPAN></A><SPAN style="mso-bookmark: _Toc115427588"></SPAN><SPAN lang=EN-US style="mso-font-kerning: 0pt"><o:p></o:p></SPAN></H1> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">没有把事务控制好Q一般会出现以下的情况:</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事务</SPAN><SPAN lang=EN-US>(){</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">  </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程</SPAN><SPAN lang=EN-US>1();</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">  </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程</SPAN><SPAN lang=EN-US>2();</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US>}</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以看出程</SPAN><SPAN lang=EN-US>1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q?/SPAN><SPAN lang=EN-US>2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">里都是单独创接,q在自己的流E里完成操作?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果在流E?/SPAN><SPAN lang=EN-US>2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">里出现异常,那么程</SPAN><SPAN lang=EN-US>1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所做的操作是不可恢复的?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果能控制在事务范围内,如:</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事务</SPAN><SPAN lang=EN-US>(){</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">  </SPAN>Connection con;</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">  </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程</SPAN><SPAN lang=EN-US>1(con);</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">  </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程</SPAN><SPAN lang=EN-US>2(con);</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">  </SPAN>con.close();</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US>}</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">那么数据库少提供一个连接,事务的完成性也得到体现。在q发数量大的时候,</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">效率上就有非常明昄区别?BR></P> <H1 style="MARGIN: 17pt 0cm 16.5pt"><A name=_Toc115427590><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">解决Ҏ</SPAN></A></H1> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo5; tab-stops: list 39.0pt"><SPAN lang=EN-US><FONT face="Times New Roman">1Q?SPAN style="FONT: 7pt 'Times New Roman'"><FONT size=3>  </FONT></SPAN></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">量保持的h</SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 10.5pt; mso-char-indent-count: 1.0; mso-char-indent-size: 10.5pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">?/SPAN><SPAN lang=EN-US><FONT face="Times New Roman">DAO</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中有</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">update()</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">ҎQ则应再扩展一个方?/SPAN><SPAN lang=EN-US><FONT face="Times New Roman">update(Connection conn)</FONT></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在业务逻辑事务里调?/SPAN><SPAN lang=EN-US><FONT face="Times New Roman">update(Connection conn)</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Q一般情况下调用</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">update()</FONT></SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo5; tab-stops: list 39.0pt"><SPAN lang=EN-US><FONT face="Times New Roman">2Q?SPAN style="FONT: 7pt 'Times New Roman'"><FONT size=3>  </FONT></SPAN></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于数据不变的情况采用缓存技术,或部分缓存技术?/SPAN></P> <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 18pt"><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-font-kerning: 1.0pt; mso-fareast-font-family: 宋体"><SPAN style="mso-spacerun: yes">      </SPAN></SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt">可参照一些相关的开源的目Q?/SPAN><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-font-kerning: 1.0pt; mso-fareast-font-family: 宋体">JIVE</SPAN><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt">Q?/SPAN></SPAN></P><img src ="http://m.tkk7.com/cyicecream/aggbug/14000.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/cyicecream/" target="_blank">ceaboat</a> 2005-09-25 17:21 <a href="http://m.tkk7.com/cyicecream/archive/2005/09/25/14000.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决JB2006启动每次注册问题http://m.tkk7.com/cyicecream/archive/2005/09/24/13936.htmlceaboatceaboatSat, 24 Sep 2005 05:45:00 GMThttp://m.tkk7.com/cyicecream/archive/2005/09/24/13936.htmlhttp://m.tkk7.com/cyicecream/comments/13936.htmlhttp://m.tkk7.com/cyicecream/archive/2005/09/24/13936.html#Feedback2http://m.tkk7.com/cyicecream/comments/commentRss/13936.htmlhttp://m.tkk7.com/cyicecream/services/trackbacks/13936.html

ceaboat 2005-09-24 13:45 发表评论
]]>
JBOAThttp://m.tkk7.com/cyicecream/archive/2005/09/15/13129.htmlceaboatceaboatThu, 15 Sep 2005 15:41:00 GMThttp://m.tkk7.com/cyicecream/archive/2005/09/15/13129.htmlhttp://m.tkk7.com/cyicecream/comments/13129.htmlhttp://m.tkk7.com/cyicecream/archive/2005/09/15/13129.html#Feedback0http://m.tkk7.com/cyicecream/comments/commentRss/13129.htmlhttp://m.tkk7.com/cyicecream/services/trackbacks/13129.html1Q运行环境:
JDKQORACLE9i以上QCASTOR包。徏议用JBUILDE
工具q行开?BR>2Q用环境:
采用ORMQ关pd象映)操作数据库数据,适用于Application与WEB方式下的开发?/FONT>

3.功能Q?BR>    提供查询Q更斎ͼ删除Q插入(没实C键自动生成),(分页暂时没实??Q用步骤:
首先在数据库建立一个cat表,字段为cat_id;name;sex;weight;cd1Q?为数字型Q?Q?BR>3为字W串型?/FONT>

其次建立两个配置文gQ由自己定义文g名称Q:
repository.xml配置信息Q?BR><?xml version="1.0" encoding="UTF-8"?>
<Repository>
 <TableDesc execid="CAT" identifyField="CAT_ID">
  <table>CAT</table>
  <condition />
 <FieldDesc name="CAT_ID" fieldType="java.lang.String" >
  <title>CAT_ID</title>
  </FieldDesc>
 <FieldDesc name="NAME" fieldType="java.lang.String" >
  <title>NAME</title>
  </FieldDesc>
 <FieldDesc name="SEX" fieldType="java.lang.String" >
  <title>SEX</title>
  </FieldDesc>
 <FieldDesc name="WEIGHT" fieldType="java.lang.Long" >
  <title>WEIGHT</title>
  </FieldDesc>
  </TableDesc>
</Repository>
配置文g的设计说明如下:
TableDesc 表示一个表的声明?BR>Execid 是类名一般情况下最好和表名一_Ҏ扑ֈ对应关系Q,但是不允许有下划U出现。注意这个类名不是全路径?BR>DentifyField 表中的主?如果是复合主键则以逗号盔R开
Table 数据库表?BR><FieldDesc name="SEX" fieldType="java.lang.String" >
  <title>SEX</title>
  </FieldDesc>
q里是表中字D늚描述Qname是字D名?fieldType 是数据库字段?BR>应java中的cdQ只?中类型可填充Qjava.lang.String,
java.lang.Long, java.util.Date, java.lang.Double
title可要可不?如果存在多个表,那么在</TableDesc>?BR></Repository>之间加入表描q?/FONT>

pool-config.xml配置信息Q?BR><?xml version="1.0" encoding="GB2312"?>
<ResourceParams>
<maxActive>10</maxActive>
<maxIdle>5</maxIdle>
<maxWait>10000</maxWait>
<username>test</username>
<password>test</password>
<driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
<url>jdbc:oracle:thin:@192.168.0.90:1521:forecast</url>
<removeAbandoned>true</removeAbandoned>
<removeAbandonedTimeout>60</removeAbandonedTimeout>
<logAbandoned>true</logAbandoned>
</ResourceParams>
把上qC息保存ؓXML文g。对q个文g不多做说明了?/FONT>

定两个文g已经存在Q接下来是要创CAT?BR>q有表所对应的BEAN?BR>下面是我在Hibernate的一个例子中建立的VO。(借用Q?BR>package com.cea.boat.dao;
  import java.util.*;
  public class Cat implements Cloneable  {
    //Declare Field
    private java.lang.String  catId;
    private java.lang.String  name;
    private java.lang.String  sex;
    private java.lang.Long  weight;
    //Get Method
    public java.lang.String getCatId() {
       return catId;
    }
    public java.lang.String getName() {
       return name;
    }
    public java.lang.String getSex() {
       return sex;
    }
    public java.lang.Long getWeight() {
       return weight;
    }
    //Set Method
    public void setCatId(java.lang.String catId) {
       this.catId=catId;
    }
    public void setName(java.lang.String name) {
       this.name=name;
    }
    public void setSex(java.lang.String sex) {
       this.sex=sex;
    }
    public void setWeight(java.lang.Long weight) {
       this.weight=weight;
    }
  public Object clone() {
    Object o = null;
    try {
      o = super.clone();
    }
    catch (CloneNotSupportedException ex) {
      System.out.println(o);
    }
    return o;
  }
  public boolean equals(Object obj) {
    Cat o = (Cat)obj;
    boolean result = true
        && (catId == o.catId || catId.equals(o.catId))
        && (name == o.name || name.equals(o.name))
        && (sex == o.sex || sex.equals(o.sex))
        && (weight == o.weight || weight.equals(o.weight))
    ;
    return result;
  }
  }
到此已经完成了该做的事了Q下面是一个用的例子?/FONT>

l查询方式Q?BR>例子Q?BR>Void testQuery() throws Exception{
    {
System.setProperty(Const.RUN_KEY, Const.POOL_FACTORY_KEY);
      System.setProperty(Const.CONFIG_PATH,
                         "E:/project/CEAConnection/pool-config.xml");
      System.setProperty(Const.REPOSITORY_CONFIG_PATH,
                         "E:/project/CEAConnection/repository.xml");
}

ConnectionManage connectionManage = new ConnectionManage();
 connectionManage.activity("com.cea.boat.dao.Cat cat");
  
   Query Query=connectionManage.createQuery(“cat. Catid=???;
    while (Query.hasNext()) {
      Object[] objects = Query.next();
      Cat cat = (Cat) objects[0];
    }
 connectionManage.close();
}
说明Q?BR>在WEB中用只需要在|站启动时声明一ơ即可?BR>{
//指明使用q接?BR>System.setProperty(Const.RUN_KEY, Const.POOL_FACTORY_KEY);
//q接池参数配|文?BR>      System.setProperty(Const.CONFIG_PATH,
                         "E:/project/CEAConnection/pool-config.xml");
//配置文g指定
      System.setProperty(Const.REPOSITORY_CONFIG_PATH,
                         "E:/project/CEAConnection/repository.xml");
}

   声明一个连接管理者,理数据库资源,事务的v始,它的生命周期最好是在一个事务结束就完结Q当然你也可以在q个事务完结时l用q个实例Q来创徏下一个事务的开始。不如此使用?BR>    ConnectionManage DataManage = new ConnectionManage();
   
Ȁz要使用c(在配|中必须有CatQ?cd为全路径如果要用多个对象,则对象间要用逗号盔R开
connectionManage.activity("com.cea.boat.dao.Cat cat");

q里只需要给出SQL查询条g比如SQL中是select * from cat cat where cat.Catid=?’那?select * from cat cat where q里后台已经帮你完成Q你需要做的就是把条g完成Q如果没有条件则为空.
Query Query = connectionManage.createQuery(“cat. Catid=???;


   Query.hasNext()的作用相当于resultset.next()查看是否q存在记录,Query.next()q回一个对象数l这里如果activity的是多个对象Q那么objects里会序的存储相应的对象实例Q用的时候强制{化就可以了?BR>while (Query.hasNext()) {
      Object[] objects = Query.next();
      Cat cat = (Cat) objects[0];
  }

使用完毕Q释放用的数据库资?BR> connectionManage.close();

l新增方式Q?BR>  ׃没有主键自动生成Q因此主键暂时只能由自己来维护,要保证catid?11的在表里不存在,否则会出现异常?BR>Void testInsert() throws Exception{
Cat cat = new Cat();
cat. setCatId(?11?;
    cat. SetSex(“F?;
    cat. setName(“catm?;
    ConnectionManage cm = new ConnectionManage();
    cm.create(cat);
    cm.commit();
cm.close();
}

l更新方式Q?BR>表里已经存在catid?11的猫Q否则查不到q条记录更C了信?BR>Void testUpdate() throws Exception{
Cat cat = new Cat();
cat. setCatId(?11?;
    cat. SetSex(“F?;
    cat. setName(“catmm?;
    ConnectionManage cm = new ConnectionManage();
    cm.update(cat);
    cm.commit();
cm.close();
}

l删除方式Q?BR>删除方式比较单,只要l出对象Qƈ且主键g为空Q就可以删除表中记录?BR>Void testDelete() throws Exception{
Cat cat = new Cat();
cat. setCatId(?11?;
    ConnectionManage cm = new ConnectionManage();
    cm.delete(cat);
    cm.commit();
cm.close();
}



ceaboat 2005-09-15 23:41 发表评论
]]>
վ֩ģ壺 һƴɫëƬ| ׾Ʒר| ŷһ| 91˾Ʒ޾Ʒ| ҹƵ| պ༤ѧ| 57paoƵ| վ߹ۿ| ޹˾Ʒ벥| þþþø߳ëƬȫ| AVһ| պ尡Ƶ߹ۿ| ѹۿվ| Ʒһ߹ۿ| ƷƵ| ˼˼þ99ѾƷ6| ޾Ʒ벻߲HE| ĻۺϾƷһ| 69avƵ| ޳aƬ߲һ| һëƬ| һƵۿwww| 99޾Ʒһ| ߹ۿѰƵ| ޱרwww| 鸣ۺĻһƵ1 | AVר߹ۿ| һƬѲ| Ʒþþþþù| ޻ɫƵ| Ʒһ߹ۿ| 999zyz**վëƬ| ɫͼۺվ| jizzjizzƵ| avվyy| ձһ| ޹ƷԲ߲| 91Ƶѹۿ| Ƶһѹۿ| Ƶ߲| ޹պ߹Ƶ|