[求助]关于JSP调用MySQL时更新数据的问题_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 2033 | 回复: 0   主题: [求助]关于JSP调用MySQL时更新数据的问题        下一篇 
ljss
注册用户
等级:新兵
经验:56
发帖:53
精华:0
注册:2012-1-19
状态:离线
发送短消息息给ljss 加好友    发送短消息息给ljss 发消息
发表于: IP:您无权察看 2014-12-15 18:17:35 | [全部帖] [楼主帖] 楼主

关于JSP调用MySQL时更新数据的问题

各位高手,我今天用JSP调用MySQL数据时成功,但是在更新字段数据时出现了问题,这个情况在用SQL Server 2000时不存在;我的系统配置如下:WinXP,Tomcat 5.5.23,j2sdk1.4.1_02;

出现的错误情况为:

org.apache.jasper.JasperException: Exception in JSP: /tree/updateHits.jsp:31
28:
29:         intHits=rs.getInt(8)+1;
30:         out.print("<br>点击数:"+intHits);
31:         rs.updateInt("hits",intHits);
32:         //strSQL="update ListPCSkill set hits="+intHits+" where ID="+sID;
33:         //rs.close();
34:         rs.updateRow();
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:467)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:371)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: Result Set not updatable.This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, the query must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.tree.updateHits_jsp._jspService(updateHits_jsp.java:151)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
com.mysql.jdbc.NotUpdatable: Result Set not updatable.This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, the query must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.
com.mysql.jdbc.UpdatableResultSet.generateStatements(UpdatableResultSet.java:1849)
com.mysql.jdbc.UpdatableResultSet.syncUpdate(UpdatableResultSet.java:1970)
com.mysql.jdbc.UpdatableResultSet.updateInt(UpdatableResultSet.java:1373)
com.mysql.jdbc.UpdatableResultSet.updateInt(UpdatableResultSet.java:1399)
org.apache.jsp.tree.updateHits_jsp._jspService(updateHits_jsp.java:117)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.


请高手帮帮忙看怎么回事,谢谢。

--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论