Using a ResultSet after executing two different queries with statement.executeQuery() [duplicate]
问题 This question already has an answer here : Invalid state, the ResultSet object is closed (1 answer) Closed 5 years ago . Given the code below: //connection stuff ResultSet rs = statement.executeQuery(query1); statement.executeQuery(query2); while(rs.next){ //code } Is the result set rs still valid even though a second statement has been executed? I know that when you close a statement the result set isn't valid any longer, but here the code is simply executing another query and not storing it