MyBatis ExecutorType.BATCH 报ORA-01000: 超出打开游标的最大数的解决

 

 MyBatis ExecutorType.BATCH 报ORA-01000: 超出打开游标的最大数的解决。

 

 

1、登陆以dba管理角色权限登陆oracle,修改oracle默认游标最大数。

查看当前打开的游标数目

select count(*) from v$open_cursor;

修改Oracle最大游标数

alter system set open_cursors=1000 scope=both;

 

2、修改代码

 最快捷方式修改 ExecutorType.BATCH 处理方式:

修改前:

 batchSession = sessionFactory.openSession(ExecutorType.BATCH, session.getConnection());

 

修改后(手动提交):

 batchSession = sessionFactory.openSession(false);

 

 PreparedStatement prest = session.getConnection().prepareStatement(
     commitFetchFrameSql, ResultSet.TYPE_SCROLL_SENSITIVE,
     ResultSet.CONCUR_READ_ONLY);
   for (FetchFrame fetchFrame : foundFrames) {
    prest.setInt(1, fetchFrame.getState().getIndex());
    prest.setTimestamp(2, new Timestamp(fetchFrame
      .getRetrieveTime().getTime()));
    prest.setInt(3, fetchFrame.getActualSpecsvsId());
    prest.setLong(4, fetchFrame.getId());
    prest.addBatch();
   }
   int[] executeBatch = prest.executeBatch();

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值