当前位置: 技术问答>java相关
ResultSet的问题??
来源: 互联网 发布时间:2017-03-31
本文导语: 我用了rs.absolute(i)函数出现下面错误: java.sql.SQLException: Invalid operation for forward only resultset : absolute at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) at oracle.jdbc.driver.BaseResultSet.absolute(BaseResultSet.java) at _nbp...
我用了rs.absolute(i)函数出现下面错误:
java.sql.SQLException: Invalid operation for forward only resultset : absolute
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.driver.BaseResultSet.absolute(BaseResultSet.java)
at _nbport._doc._dailyrptresult__jsp._jspService(/usr/local/apache/htdocs/nbport/doc/dailyrptresult.jsp:83)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:497)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:312)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:342)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:272)
at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
at java.lang.Thread.run(Thread.java:536)
java.sql.SQLException: Invalid operation for forward only resultset : absolute
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.driver.BaseResultSet.absolute(BaseResultSet.java)
at _nbport._doc._dailyrptresult__jsp._jspService(/usr/local/apache/htdocs/nbport/doc/dailyrptresult.jsp:83)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:497)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:312)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:342)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:272)
at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
at java.lang.Thread.run(Thread.java:536)
|
用下面的代碼看看
Statement statement=con.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
Statement statement=con.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
|
你如果是这样定义的:
Statement statement=con.createStatement();
那么由此产生的rs只有next()属性,不支持first(),last()或者是absolute()这些属性,你要向楼上这样定义才可以
Statement statement=con.createStatement();
那么由此产生的rs只有next()属性,不支持first(),last()或者是absolute()这些属性,你要向楼上这样定义才可以