连接池的配置文件如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- the proxool configuration can be embedded within your own application's.
Anything outside the "proxool" tag is ignored. -->
 <something-else-entirely>
  <proxool>
   <alias>xml-test</alias>
   <driver-url>jdbc:mysql://127.0.0.1:3306/itfuture?autoReconnect=true</driver-url>
   <driver-class>com.mysql.jdbc.Driver</driver-class>
   <driver-properties>
     <property name="user" value="root"/>
     <property name="password" value="123456"/>
   </driver-properties>
   <maximum-connection-count>500</maximum-connection-count>
   <house-keeping-test-sql>select getdate()</house-keeping-test-sql>
  </proxool>
</something-else-entirely>

解决方案 »

  1.   

    在jsp中按照如下方式使用DAO:
             在jsp中没调用一次要关闭资源rs,但dao中的其它资源并不关闭,在本页面中的其它地方使用完之后再关闭,使用如下:
                <% 
                  String sql="select A.* from webcontent";
    DAO dao=new DAO();
        ResultSet rs=dao.doQuery(sql);
        while(rs.next()){
          int cid=rs.getInt("cid");
          String title=rs.getString("ctitle");
    %>
                 <tr>
                   <td width="20" height="22"><div align="center"><img src="images/index_19.jpg" width="6" height="6"></div></td>
                   <td width="175" height="22"><a href="show.jsp?cid=<%=cid%>" target="_blank" class="b12">
                    <%=title%></a>
                   </td>
                 </tr>
                <%
                 }
                 rs.close();
                 sql="select A.* from webclass";
         rs=dao.doQuery(sql);
         while(rs.next()){
              int cid=rs.getInt("cid");
              String title=rs.getString("ctitle");
              String infotime=rs.getString("cinfotime");
                %>
                        <table width="100%" height="25"  border="0" align="center" cellpadding="0" cellspacing="0" class="unnamed1">
                          <tr>
                            <td width="23" height="22"><div align="center"><img src="images/tubaio.jpg" width="9" height="7"></div></td>
                            <td width="431" height="22"><a href="show.jsp?cid=<%=cid%>" target=_blank> <%=title %> </a> </td>
                            <td width="107"><%=(infotime.substring(0,10))%></td>
                          </tr>
                        </table>
                <%
                        }
                        rs.close();
                        dao.Close();
                %>
                 
        但每次使用之后老是出现 在关闭Statement之后有执行操作的提示,有时得到statement的是null,系统运行两天mysql数据库就不能用了。必须重起整个系统,mysql数据库才能使用,重起tomcat和mysql,mysql还是不能用。
      

  2.   

    急等!如果可以解决可以在加200分,4个100分的帖!
    另外一帖!
    http://community.csdn.net/Expert/topic/5501/5501150.xml?temp=.4464075
      

  3.   

    好长啊
    楼主为何在DAO.close()方法中关闭connection却不关闭其它?
    而且rs在JSP中已经关闭了,在dao中却又关闭一次?
      

  4.   

    mysql数据库就不能用应该是proxool的连接用完了,很多有效连接被废置,这个还需要检查proxool的配置。
    比如有个配置项是house-keeping-test-sql,如果这条语句配置不正确也会引发该问题,我们是用:select CURRENT_DATE
      

  5.   

    可以把dao中的connection设为static
    你出的错误应该是连接太多!
      这样保证解决问题!