【发布时间】:2016-05-02 07:43:07
【问题描述】:
我正在尝试传递一个 sql 查询,但我收到 "java.sql.SQLException: Operation not allowed after ResultSet closed" 。我已经根据 stackoverflow 中的相同异常进行了其他对话,但我仍然不明白这个问题。
代码如下:
String query="SELECT candidate,pan from hcl_candidates where jngstat='Joined'";
statement=conn.createStatement();
resultset=statement.executeQuery(query);
while(resultset.next()){
statement.executeUpdate("insert IGNORE into allinvoice (candidate,pan,invdate,client) select candidate,pan,CURDATE(),'HCL' from hcl_candidates where jngstat='Joined'");
}
}
//catch block
finally
{
try
{
if(statement!=null)
{
statement.close();
}
if(conn!=null){
conn.close();
}
if(resultset!=null){
resultset.close();
}
}
// catch block
}
这里是错误:
java.sql.SQLException: Operation not allowed after ResultSet closed
//So on
【问题讨论】:
-
您的程序没有被阻止。