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();
两者处理方式都行,但是从性能来看 第一种方式处理效率比第二种最快快了1倍。
不建议从根本上解决问题,这涉及修改源码。 目前这种情况碰到oracle才出现过,所以,应该oracle特性导致的。
原因:应该是打开的statement或者preperedment过多导致的。而mybatis的这种ExecutorType.BATCH 处理方式是以List的preperedment来处理的。
有人说因为session.close是回到连接池而没有关闭连接的,我怀疑这种说法,因为跟踪了源码应该与session.close是无关的。
分享到:
相关推荐
赠送jar包:mybatis-paginator-1.2.15.jar; 赠送原API文档:mybatis-paginator-1.2.15-javadoc.jar; 赠送源代码:mybatis-paginator-1.2.15-sources.jar; 赠送Maven依赖信息文件:mybatis-paginator-1.2.15.pom;...
eclipse mybatis.generator.eclipse.site- 插件eclipse mybatis.generator.eclipse.site- 插件
赠送jar包:mybatis-plus-boot-starter-3.5.1.jar; 赠送原API文档:mybatis-plus-boot-starter-3.5.1-javadoc.jar; 赠送源代码:mybatis-plus-boot-starter-3.5.1-sources.jar; 赠送Maven依赖信息文件:mybatis-...
赠送jar包:mybatis-plus-extension-3.5.1.jar; 赠送原API文档:mybatis-plus-extension-3.5.1-javadoc.jar; 赠送源代码:mybatis-plus-extension-3.5.1-sources.jar; 赠送Maven依赖信息文件:mybatis-plus-...
今天在项目中,使用Mybatis对oracle数据库进行操作的时候,报出ORA-00911: invalid character的错误,检查了一下SQL,发现都书写正确啊,复制到plsql上执行也都没问题,这什么原因呢? 注意:这里说的是用navicat...
赠送jar包:mybatis-plus-boot-starter-3.1.0.jar; 赠送原API文档:mybatis-plus-boot-starter-3.1.0-javadoc.jar; 赠送源代码:mybatis-plus-boot-starter-3.1.0-sources.jar; 赠送Maven依赖信息文件:mybatis-...
赠送jar包:mybatis-spring-boot-autoconfigure-2.1.1.jar; 赠送原API文档:mybatis-spring-boot-autoconfigure-2.1.1-javadoc.jar; 赠送源代码:mybatis-spring-boot-autoconfigure-2.1.1-sources.jar; 赠送...
本工程为 MyBatis-Plus 的官方示例,项目结构如下: mybatis-plus-sample-quickstart: 快速开始示例 mybatis-plus-sample-quickstart-springmvc: 快速开始示例(Spring MVC版本) mybatis-plus-sample-reduce-...
然后打开eclipse ->Window->prefenrence->XML->XML Catalog->User Specifiled Entreis->Add->Location(此处是你放dtd文件的位置例如:D:\mybatis\mybatis-3-config.dtd)->Key(如果更改config,此处应该是:-//...
mybatis-3.2.7.jar mybatis-3.2.2.jar mybatis-3.1.1.jar
赠送jar包:mybatis-spring-boot-autoconfigure-1.3.2.jar; 赠送原API文档:mybatis-spring-boot-autoconfigure-1.3.2-javadoc.jar; 赠送源代码:mybatis-spring-boot-autoconfigure-1.3.2-sources.jar; 赠送...
idea创建Maven项目时,报错显示Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources,并且Maven插件内看不到 mybatis-generator。如下图: 折腾了好久发现配置放错地方了,...
赠送jar包:mybatis-generator-core-1.3.7.jar; 赠送原API文档:mybatis-generator-core-1.3.7-javadoc.jar; 赠送源代码:mybatis-generator-core-1.3.7-sources.jar; 赠送Maven依赖信息文件:mybatis-generator-...
------------------------- ------------------------ mybatis-3.2.2.jar --------------------------- ------------------------
jeecg-mybatis-framework20131220.zipjeecg-mybatis-framework20131220.zipjeecg-mybatis-framework20131220.zipjeecg-mybatis-framework20131220.zipjeecg-mybatis-framework20131220.zipjeecg-mybatis-framework...
赠送jar包:mybatis-spring-boot-autoconfigure-1.3.2.jar; 赠送原API文档:mybatis-spring-boot-autoconfigure-1.3.2-javadoc.jar; 赠送源代码:mybatis-spring-boot-autoconfigure-1.3.2-sources.jar; 赠送...
mybatis-plug.jar和 mybatis-plug的安装说明
赠送jar包:mybatis-spring-boot-autoconfigure-2.1.1.jar; 赠送原API文档:mybatis-spring-boot-autoconfigure-2.1.1-javadoc.jar; 赠送源代码:mybatis-spring-boot-autoconfigure-2.1.1-sources.jar; 赠送...
mybatis-3.2.7.jar source code API configuration.xml settings defaultStatementTimeout 的设置 MyBatisDemo 常用例子 使用3种方法,编写mapper,操作数据库
赠送jar包:mybatis-spring-boot-autoconfigure-2.1.3.jar; 赠送原API文档:mybatis-spring-boot-autoconfigure-2.1.3-javadoc.jar; 赠送源代码:mybatis-spring-boot-autoconfigure-2.1.3-sources.jar; 赠送...