社区
Web 开发
帖子详情
分页操作时出现javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 无效的游标状态
jiangcui2003
2008-12-18 09:42:43
我时新手
请问哪为专家能给解答一下 在线等 谢谢
源代码我贴在下面了
...全文
201
4
打赏
收藏
分页操作时出现javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 无效的游标状态
我时新手 请问哪为专家能给解答一下 在线等 谢谢 源代码我贴在下面了
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
lyf_sust
2008-12-25
打赏
举报
回复
rs1.next();
next的次数会不会有问题
jiangcui2003
2008-12-19
打赏
举报
回复
等待中>>>>>>>>>>>>>>>>
jiangcui2003
2008-12-18
打赏
举报
回复
错误提示
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /teacher/kaoshi/xzt.jsp at line 63
60: rs1.next();
61: n++;
62: i++;
63: id=rs1.getInt("ID");
64: timu=rs1.getString("question");
65:
66: %>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 无效的游标状态
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
org.apache.jsp.teacher.kaoshi.xzt_jsp._jspService(xzt_jsp.java:231)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 无效的游标状态
sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
sun.jdbc.odbc.JdbcOdbc.SQLGetDataInteger(Unknown Source)
sun.jdbc.odbc.JdbcOdbcResultSet.getDataInteger(Unknown Source)
sun.jdbc.odbc.JdbcOdbcResultSet.getInt(Unknown Source)
sun.jdbc.odbc.JdbcOdbcResultSet.getInt(Unknown Source)
org.apache.jsp.teacher.kaoshi.xzt_jsp._jspService(xzt_jsp.java:130)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.10
jiangcui2003
2008-12-18
打赏
举报
回复
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>浏览试卷</title>
</head>
<body>
<jsp:useBean id="connect" class="mybean.Connect" scope="page">
</jsp:useBean>
<div align="left">以下是本门课程的所有单项选择题,请添加组成试卷:
<a href="llsj.jsp">返回</a></div>
<hr align="left" />
<div align="left">
<%
String coursename=(String)session.getAttribute("coursename");
if(coursename==null)
response.sendRedirect("../../index.jsp");
String name=(String)session.getAttribute("name");
%>
<%
String sql1="select * from qmxzt where name='"+coursename+"'and type='选择题'";
Statement stmt1=connect.conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
Statement stmtcount=connect.conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs1=null;
String timu=null;
rs1=stmt1.executeQuery(sql1);
String sqlcount="select count(*) from qmxzt where name='"+coursename+"'and type='选择题'";
ResultSet rscount=stmtcount.executeQuery(sqlcount);
int pageSize=5;
int rowCount=0; //总的记录数
while (rscount.next()){
rowCount=rscount.getInt(1);
}
int pageCount; //总的页数
int currPage; //当前页数
String strPage;
strPage=request.getParameter("page");
if (strPage==null){
currPage=1;
}
else{
currPage=Integer.parseInt(strPage);
if (currPage<1) currPage=1;
}
pageCount=(rowCount+pageSize-1)/pageSize;
if (currPage>pageCount) currPage=pageCount;
int thepage=(currPage-1)*pageSize;
int n=0;
rs1.absolute(thepage+1);
int i=0;
int id=0;
%>
<strong>(一)单项选择题:</strong>
<table width="636" height="62" border="1" align="left" cellspacing="3">
<%
while(n<(pageSize)&&!rs1.isAfterLast())
{
rs1.next();
n++;
i++;
id=rs1.getInt("ID");
timu=rs1.getString("question");
%>
<tr><td width="533" height="28"><%=i%> <%=timu%> </td>
<td width="87"><a href="zj.jsp?id=<%=id%>">选择为试题</a></td>
</tr>
<% }
%>
<tr>
<td height="23" colspan="2"><form name="sinfo" method="post" action="xzt.jsp?type='选择题'" onSubmit="return testform(this)">
<p>第<%=currPage%>页 共<%=pageCount%>页 共<%=rowCount%>条
<%if(currPage>1){%>
<a href="xzt.jsp?xzt.jsp?type='选择题'">首页</a>
<%}%>
<%if(currPage>1){%>
<a href="xzt.jsp?page=<%=currPage-1%>&type='选择题'">上一页</a>
<%}%>
<%if(currPage<pageCount){%>
<a href="xzt.jsp?page=<%=currPage+1%>&type='选择题'">下一页</a>
<%}%>
<%if(pageCount>1){%>
<a href="xzt.jsp?page=<%=pageCount%>&type='选择题'">尾页</a>
<%}%>
跳到
<input type="text" name="page" size="4" style="font-size:9px">
页
<input type="submit" name="submit" size="4" value="GO" style="font-size:9px">
</p>
</form> </td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
<%
rs1.close();
rs1=null;
stmt1.close();
stmt1=null;
rscount.close();
rscount=null;
stmtcount.close();
stmtcount=null;
connect.closed();
%>
</html>
ODBC
驱动程序
管理器
无效
的
游标
状态
我用的tomcat 7.0,eclipse 8.5,已经把class12.jar放到tomcat的lib目录下,oracle是9.2,表login的列we和ss都是varchar2(10)类型。在执行下列代码
时
: String url="jdbc:
odbc
:bksfhcxt"; String user="system"; String password="oracle2
java
.
sql
.
SQL
Exception
: Before start of result set异常及处理办法
把只有一条记录的结果集ResultSet的数据存储到实体类Book。
java
.
sql
.
SQL
Exception
: 结果集已耗尽
2013年10月21日 星期一 21
时
43分23秒 说明: 继上次的
java
.
sql
.
SQL
Exception
: ORA-01013: user requested cancel of current operation 错误。查了两天也没查出具体原因。后在同事的建议下,延长查询
时
间。因为生产库不能随意重启, 于是就写了个testQuery.jsp测试页面来测试生产环境中...
java
光标位置
无效
_ResultSet.getString(1)引发
java
.
sql
.
SQL
Exception
:当前光标位置的
无效
操作
...
当我运行以下
servlet
时
:// package projectcodes;public void doPost(Http
Servlet
Request request,Http
Servlet
Response response) throws
Servlet
Exception
,IO
Exception
{String UserID = request.getParameter("UserID");S...
错误堆砌的人生
只是做了一个文件上传(已完工),但错误百出。今天贴上来,纪念下。我在想这一生是不是将会这样进行下去…… Description:com.jacob.com.ComFail
Exception
: Invoke of: ItemSource:
Microsoft
Word
java
x.
servlet
.
Servlet
Exception
:
java
.lang.NoClassDefFoundErr
Web 开发
81,116
社区成员
341,738
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章