高分求答案:structs中request的作用域

helenofnt 2004-10-29 04:29:10
最近遇到一个棘手的问题
具体如下:
http://community.csdn.net/Expert/topic/3497/3497537.xml?temp=.3190424

有人说是request 没有释放造成的
有人说requset也可以有象SESSION一样用
有很长的存活期
反正俺现在是晕了
不知道哪里出了问题


高分求解决方案!
...全文
207 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
funcreal 2004-11-01
  • 打赏
  • 举报
回复
用缓冲池阿。
建议把数据放到List里面。数据库连接及时关闭
schee 2004-11-01
  • 打赏
  • 举报
回复
估计不是释没释放的问题;
那你再仔细检查一下你对数据库操作以及代码的逻辑是否正常;
检查有没有出现死循环的可能性;
manyroads 2004-10-30
  • 打赏
  • 举报
回复
首先申请的资源在使用完了以后要及时释放,
其次查询的字段尽可能少。
下面是我写的查询数据库的代码:
package com.yxmis.web.consign.dao;

import java.util.List;
import java.util.ArrayList;
import java.sql.*;
import com.yxmis.web.consign.dto.ConsignDto;
import com.yxmis.web.common.dbop.IYxmisDbConnection;
/**
*
* <p>Title: 委托监测统计</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: nantian</p>
* @author Manyroads
* @version 1.0
*/
public class ConsignDao {
public List findByBelongRoad(IYxmisDbConnection dbcon,
String startTime,
String endTime) throws SQLException {
PreparedStatement pstmt = null;
ResultSet rs = null;
ResultSet rsEnd = null;
List list = null;

// 根据查询时间段查询出街道对应的行政处罚信息数
String sqlStr =
"select belong_road, end_flag from t_consign_task, t_pollute_report where t_pollute_report.corp_no = t_consign_task.corp_no and consign_date >= ? and consign_date <= ?";

try {
pstmt = dbcon.getPreparedStatement(sqlStr);
pstmt.setString(1, startTime);
pstmt.setString(2, endTime);
rs = pstmt.executeQuery();
if (rs != null) {
list = new ArrayList();
while (rs.next()) {
ConsignDto consign = new ConsignDto();
//从结果集中取得纪录并填充数据传输对象
consign.setQueryType(rs.getString(1));
consign.setEndFlag(rs.getString(2));
//存储到List中
list.add(consign);
}
}
}
catch (SQLException sqle) {
throw sqle;
}
finally {
if (rs != null) {
try {
rs.close();
}
catch (Exception ignore) {}
}
if (pstmt != null) {
try {
pstmt.close();
}
catch (Exception ignore) {}
}
}
return list;
}
}
helenofnt 2004-10-29
  • 打赏
  • 举报
回复
不能沉啊!!!!!!!!!
helenofnt 2004-10-29
  • 打赏
  • 举报
回复
肯定都关了
RESULTSET 也关了
schee 2004-10-29
  • 打赏
  • 举报
回复
你在执行完数据库操作后 有关闭代码:stmt.close();和conn.close();吗?

50,504

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧