记录集问题
为什么我的rs在close的时候,就抛异常,不能关闭列?
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]sp_cursorfetch: 所提供的游标标识符值(0)无效。
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.closeCursor(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.completeRowProcessing(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplResultSet.close(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.close(Unknown Source)
at org.apache.commons.dbcp.DelegatingResultSet.close(DelegatingResultSet.java:193)
at DBManager.DBManager.getDB_closeConnection(DBManager.java:39)
at DBManager.DBManager.getDB_returnArrayListSelect(DBManager.java:138)
at com.yourcompany.struts.action.IsWhichWebAction.execute(IsWhichWebAction.java:69)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:425)
at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:452)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
at java.lang.Thread.run(Unknown Source)
------解决方案--------------------可能已经关闭了吧
if(!(rs==null||rs.isClose())){
rs.close() ;
}
------解决方案--------------------看看你的连接关了没有。
先关rs再关连接
------解决方案--------------------创建顺序:
先connection,然后是statement,最后是rs
关闭顺序则相反
估计你的rs已经关闭了,然后你又关闭,对null对象操作?
------解决方案--------------------if(con != null){con.close()}
在看看关闭顺序!有点晕。