应该是在某处出错后没有关闭连接而导致连接变成了死连接,你再仔细看一看有哪个地方没有写close.依照现在的情况就算你将用户加到100个也会出现同样的错误的.
解决方案 »
- struts2如何返回空值?
- struts2 中Action 怎么安条件查询怎么安条件查询
- hibernate criteria
- java与数据库连接,数据库文件应该怎么存放
- EJB3.0 访问的问题 Can not make remoting client invocation due to not being connected to server.
- struts动态ActionForward问题
- 大家在开发过程中都使用了哪种个模式?大致介绍一下,多谢了!
- 关于stuts1.2表单验证的疑问,进来讨论下!不知我的思路是否正确!
- 求救,怎样对一个jpg或gif图片文件压缩它的大小
- 请教如何在IBM的WSAD中使用javamail组件?
- 把整个Web应用打包为hello.war文件时,发生错误,请大家帮忙!
- 〈html:link action="subject.do?method=add"〉method struct-config.xml如何定义
而且每个ResultSet对象,每个Statement对象在使用后必须关闭,否则数据库的Cursor也会用光!
建议按照如下格式书写对数据库访问的代码:
Connetion dbCon=null;
Statement stmt=null;
ResultSet resultSet=null
try
{
dbCon=.....//从缓冲池中获取数据库连接,最好封装成一个类。
stmt=dbCon.CreateStatement();
resultSet=stmt.executeQuery(sql);
...
...
...
}
finally
{
if (resultSet!=null) resultSet.Close();
if (stmt!=null) stmt.Close();
if (dbCon!=null) dbCon.Close();
}