JDBC - Technical White Papers --JDBC FAQ --JDBC 2.0 Features --JDBC Compatability Paper
jew(木鱼) 还是没有发现问题的原因
你的 Statement stmt=connect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs=stmt.executeQuery("select * from "+this.tableName+" for update"); 的作用是 create a scrollbale result set that is updatable and sensitive to updates. 我怀疑你的数据库是否被设为只读。
Statement类的executeUpdate方法返回值是long不是ResultSet
你的RESULSET不可以使用RS.UPDATEXXX()的方法吗!?
不要使用你的那句SQL,可以使用一个简单的查询试试看!应该可以的!
executeUpdate()只能执行insert,update,delete等sql语句
再说它的返回值是一个long型,不是 ResultSet
就是不能执行updateXXX
java.sql.SQLException :对只读结果级的无效操作 updateString;
--JDBC FAQ
--JDBC 2.0 Features
--JDBC Compatability Paper
还是没有发现问题的原因
Statement stmt=connect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs=stmt.executeQuery("select * from "+this.tableName+" for update");
的作用是
create a scrollbale result set that is updatable and sensitive to updates.
我怀疑你的数据库是否被设为只读。
Statement stmt=connect.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);下的updateString()操作。
可以执行INSERT语句
我试了是可以的
classes12.zip或classes12.jar
但是不知道你的"for update"是干什么用的(对SQL不是很懂)
我加上即出错
去掉就成功
--- ZJQ