Orcale关于错误的描述:ORA-01000 maximum open cursors exceeded
Cause: A host language program attempted to open too many cursors. The
initialization parameter OPEN_CURSORS determines the maximum number of
cursors per user.
Action: Modify the program to use fewer cursors. If this error occurs often,
shut down Oracle, increase the value of OPEN_CURSORS, and then restart
Oracle.希望能帮助你!
Cause: A host language program attempted to open too many cursors. The
initialization parameter OPEN_CURSORS determines the maximum number of
cursors per user.
Action: Modify the program to use fewer cursors. If this error occurs often,
shut down Oracle, increase the value of OPEN_CURSORS, and then restart
Oracle.希望能帮助你!
可能是你在循环中使用ResultSet造成的。
这个问题呢?我是用的在循环中用的insert!不改open_cursors项的话是否就要在一定的优标数后提交关闭连接再打开连接!
这样是不是不好!
还是改优标数量的好?
{
sql = "insert something";
pstate.execute(sql);
}
conn.close();Then what should i do !
while(Vector.hasNext())
{
sql = "insert something";
pstate.execute(sql);
conn.close(); }
PreparedStatement每次用完了以后需要关闭。ResultSet也一样需要关闭。最后Connection用完了以后再关掉Connection,养成好的编程习惯很重要。
是这样的:oracle中游标分为两种分为两种
:一种是显示游标
一种是隐式游标数据库中,对于同时打开的显示游标数是有限制的
这个限制在数据库配置文件中可以找到
你也可以执行一下sql进行查看
select * from v$parameter where name = 'open_cursors'
按照你的结果,查询出来的结果数应该是300
这是oracle数据库缺省的最大数,超过这个数时就会报
超出游标最大值的错误
怎样察看当前session的油标数呢?
对于没一个连接id,在oracle中都对应一个高速缓存。
这些高速缓存缓存一些打开的游标,可以在v$open_cursor中
察看打开的游标(包括隐式和显式),理论上一个显示游标
就对应jdbc中一个statment也就是说你如果不关闭statment
打开的游标数将不断增加。直至这个session不可用了。
所以最好的解决方法。是关闭statment而不是增加最大数。这
会对数据库造成不良影响。
如果你想利用高速缓存的特性增加性能。orace jdbc中已经提供了一些方法
用来缓存statment
检查一下你的程序,将所有的ResultSet close掉。