[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

MAXIMUM CURSORS EXCEEDED in Oracle 8.7.1

Heather Koch

9/12/2002 4:18:00 PM

I have a form that allows the user to execute ad-hoc type queries on a
specific table in an oracle 8.7.1 database. After executing 2 or three
queries, I get an exception from the database reading MAXIMUM NUMBER OF
CURSORS EXCEEDED.

I am using the oracle client downloaded from the Microsoft web site and I'm
using the Oracle Data Adapter to execute a stored proc and retrieve a ref
cursor which I then use to fill a DataSet.
Each time I execute one of these commands, I explicitly Open and Close my
Oracle Connection.

I have other screens that are polling Oracle tables -- doing selects every
10 seconds -- using the exact same method call which do not encounter this
problem.

Any ideas?


1 Answer

(Microsoft Developer Support)

9/18/2002 3:34:00 PM

0

Hi Heather,

This could be a problem that was caused by the untimely release of
unmanaged resources, namely
the cursor to the Oracle database. The DataAdapter does not immediately
"dispose" of the DataReader, but rather puts it on the garbage heap so that
it can be taken care of when the GC gets around to it. Unfortunately, in
some instances, this occurs too late for Oracle, whose default limit for
open cursors is only 50.

There could be two workarounds for this problem. The one is not to use a
local variable for the DataAdapter, but rather a global variable which
would be re-used. Internally, what I believe is going on there, it that
the DataAdapter cannot re-use the DataReader so instead, it disposes of the
current one and creates a new one.

The other work-around is to explicitly dispose of the command object which
created the DataReader. In this case, you would call
DataAdapter.SelectCommand.Dispose(); This also will immediately dispose of
the associated DataReader.

Hope this helps.

Thanks
Syed Mehdi
Microsoft Developer Support


This posting is provided “AS IS” with no warranties, and confers no rights.
Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.co....