`

解决使用mybatis出现ORA-01000问题

阅读更多
mybatis未使用spring集成。
现象:
1.当执行查询时报
### Error querying database.  Cause: java.sql.SQLException: ORA-01000: maximum open cursors exceeded
2.检查业务服务器与数据库之间的连接数:正常;
3.使用sys用户登录数据库,执行SQL
select o.sid, osuser, machine, count(*) num_curs
from v$open_cursor o, v$session s
where o.sid=s.sid
group by o.sid, osuser, machine
order by  num_curs desc;
发现游标数的确打开很多。

解决办法:
在mybatis配置文件中设置参数defaultExecutorType值为SIMPLE或删除该配置项。

文档解释:
Configures the default executor. SIMPLE executor does nothing special. REUSE executor
reuses prepared statements. BATCH executor reuses statements and batches updates.

REUSE/BATCH会重用preparestatement,最终导致此问题。

影响:有性能损失,mybatis的此配置本用于提高性能。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics