我有一个JSP页面调用SQL存储过程,有时会出现页面死掉的问题,不知道什么原因,请教大家。存储过程都是最简单的SELECT语句。Connection conn = null;
Statement stmt = null;
ResultSet rs = null;conn = KDBConnect.getConnection();
CallableStatement proc = null;
<%
proc = conn.prepareCall("{call QUERY_BBS_LIST_TJRT_VIEW () }"); proc.execute();
rs = (ResultSet) proc.getResultSet();
num = 0;
while (rs.next()) {
num++;
String id = rs.getString("id");
String bt = rs.getString("bt");
} if(proc != null)
{
proc.close();
proc = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
proc = conn.prepareCall("{call QUERY_BBS_LIST_TJ_VIEW () }"); proc.execute();
rs = (ResultSet) proc.getResultSet();
num = 0;
while (rs.next()) {
num++;
String id = rs.getString("id");
String bt = rs.getString("bt");
} if(proc != null)
{
proc.close();
proc = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
%><%
KDBConnect.closeConnect(conn, stmt);
%>
Statement stmt = null;
ResultSet rs = null;conn = KDBConnect.getConnection();
CallableStatement proc = null;
<%
proc = conn.prepareCall("{call QUERY_BBS_LIST_TJRT_VIEW () }"); proc.execute();
rs = (ResultSet) proc.getResultSet();
num = 0;
while (rs.next()) {
num++;
String id = rs.getString("id");
String bt = rs.getString("bt");
} if(proc != null)
{
proc.close();
proc = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
proc = conn.prepareCall("{call QUERY_BBS_LIST_TJ_VIEW () }"); proc.execute();
rs = (ResultSet) proc.getResultSet();
num = 0;
while (rs.next()) {
num++;
String id = rs.getString("id");
String bt = rs.getString("bt");
} if(proc != null)
{
proc.close();
proc = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
%><%
KDBConnect.closeConnect(conn, stmt);
%>
解决方案 »
- 求助:中文参数传递问题
- JS 求救 INPUT id="up_file" type="file" 难度很大!!!。
- 为什么在Jbuilder2006中为JSP页面设背景用background就报错,但又可以运行?
- 如何关掉Hibernate运行是在控制台输出的日志。
- [请教高手]有没有办法把数组型(数组的元素为封装过的对象)由页面传给后台(或其他页面)?
- 我要jspsmartupload组件,在resin中如何配置才可以用?
- 几个可以研究的问题(200)(来者有分)!
- 如何判断session失效
- 如何统计一条纪录被察看的次数?
- 怎么判断一个值是否是有效的web上的color值?
- 一次奇怪的改变属性数据类型的经历
- 开发一个在线教育系统的网站
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
Connection con=java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=***","***","***");
PreparedStatement pstmt =con.prepareStatement("{call spAll_ReturnCounts('"+sCondition+"')}");//这里是相应的传入参数,没有更好。
ResultSet rs = pstmt.executeQuery();