连接池的配置文件如下:
<?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>
<?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>
解决方案 »
- hql update
- 公司内网如何做规章制度的展示
- s2sh整合出现异常
- poi如何插入图片
- 关于struts的国际化问题,可以让用户自己选择语系吗?
- weblogic 下div加载不了别的页面
- 土问,在jboss上开发应用程序
- 哪里有jdbc for sqlserver7 急啊?
- 这是我在j2ee中resource.properties中的数据库配置,在jsp页面里测试总是提示这个错误。
- java邮件系统问题,大神速来~
- [300分]如何写一个监听的Servlet对配置在web.xml中的config.xml进行解析,并把config.xml中的一个Servlet实例化加载到缓存中并在程序
- 初学者 javamail写的smtp客户端向163发送邮件失败 求救
在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还是不能用。
另外一帖!
http://community.csdn.net/Expert/topic/5501/5501150.xml?temp=.4464075
楼主为何在DAO.close()方法中关闭connection却不关闭其它?
而且rs在JSP中已经关闭了,在dao中却又关闭一次?
比如有个配置项是house-keeping-test-sql,如果这条语句配置不正确也会引发该问题,我们是用:select CURRENT_DATE
你出的错误应该是连接太多!
这样保证解决问题!