1. 程式人生 > >at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:794)

at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:794)

at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:794)
	at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7077)
	at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207)
	at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207)
	at cn.com.Socket.Term.term(Term.java:32)
	at cn.com.Socket.ThreadReader.insert_num(ThreadReader.java:141)
	at cn.com.Socket.ThreadReader.othernum(ThreadReader.java:126)
	at cn.com.Socket.ThreadReader.read(ThreadReader.java:65)
	at cn.com.Socket.ThreadReader.Port(ThreadReader.java:39)
	at cn.com.Socket.ThreadReader.run(ThreadReader.java:21)
	at java.lang.Thread.run(Thread.java:744)
0100ffffff00002b  2018-11-08 13:29:04
java.sql.SQLException: Operation not allowed after ResultSet closed
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
	at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:794)
	at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7077)
	at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207)
	at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207)
	at cn.com.Socket.Term.term(Term.java:32)
	at cn.com.Socket.ThreadReader.insert_num(ThreadReader.java:141)
	at cn.com.Socket.ThreadReader.othernum(ThreadReader.java:126)
	at cn.com.Socket.ThreadReader.read(ThreadReader.java:65)
	at cn.com.Socket.ThreadReader.Port(ThreadReader.java:39)
	at cn.com.Socket.ThreadReader.run(ThreadReader.java:21)
	at java.lang.Thread.run(Thread.java:744)
0100ffffff00002b  2018-11-08 13:29:04
java.sql.SQLException: Operation not allowed after ResultSet closed
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
	at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:794)
	at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7077)
	at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207)
	at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207)
	at cn.com.Socket.Term.term(Term.java:32)
	at cn.com.Socket.ThreadReader.insert_num(ThreadReader.java:141)
	at cn.com.Socket.ThreadReader.othernum(ThreadReader.java:126)
	at cn.com.Socket.ThreadReader.read(ThreadReader.java:65)
	at cn.com.Socket.ThreadReader.Port(ThreadReader.java:39)
	at cn.com.Socket.ThreadReader.run(ThreadReader.java:21)
	at java.lang.Thread.run(Thread.java:744)
0100ffffff00002b  2018-11-08 13:29:04

 

一定要注意,

conn,st ,rs這三個的關係,只有conn連線狀態下,執行事務st,才能有rs結果集

如果你的程式執行到了rs=st.executeQuery();

別以為到了這一步,反正rs結果集也獲取到了,就可以關閉conn,st了;

因為你的結果集並沒有放在集合裡面,rs能獲取資料的前提仍然是conn連線狀態