有如果典型的java的spring jdbc调用了存储过程,返回游标形结果集。如果循环调用此方法。则会造成 ORA-01000: 超出打开游标的最大数。原因是没有及时关闭oracle中的游标,但按理说jdbcTemplate模版已经关闭了链接,但始终无法关闭游标。请问有什么办法可以关闭游标吗?
Object obj=jdbcTemplate.execute(new CallableStatementCreator(){
@Override
public CallableStatement createCallableStatement(Connection con) throws SQLException {
// TODO Auto-generated method stub
String execuSql = "{call batch51(?)}";;
cs.registerOutParameter(1, OracleTypes.CURSOR);// 注册输出参数的类型
return cs;
}
}, new CallableStatementCallback(){
public Object doInCallableStatement(CallableStatement cs) throws SQLException,DataAccessException {
List resultsJson = new ArrayList();
cs.execute();
ResultSet refcursor = (ResultSet) cs.getObject(1);// 获取游标一行的值
while (refcursor.next()) {// 转换每行的返回值到Map中
JSONObject json = new JSONObject();
json.accumulate("busname",refcursor.getString("busname"));
resultsJson.add(json);
}
refcursor.close();
return resultsJson;
}
});
http://www.cnblogs.com/icerainsoft/archive/2011/08/24/2152381.html