473,396 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

explicitly closing cursors

Hi,

Version : Oracle 8.1.7.0.0

I'm running a batch application that basically performs a potentially high
number of SELECT queries (a minor proportion of UPDATEs as well), using the
OCI.
After some 300 statements get executed, I'm faced with the recurrent
ORA-01000 error message that says "maximum open cursors exceeded". I checked
my OCIHandleFree() calls, there's no mismatch, meaning they match the calls
to OCIHandleAllocate().

My understanding is that to close cursors, you have to
- either let go of the connection, which i don't want to do because it'd be
way too costly for me to open and close a connection on each request,
- or as it says in the online documentation "explicitly close any open
cursor during the execution of (my) program".

After some amount of searching through documentation, my question is : how
on earth do I explicitly close an open cursor ?
What leaves me somewhat perplexed is that i came across the following
statement somewhere else in the online help : "Oracle 8i does not use
cursors any more". Well my impression is that it jolly well does, if only to
issue error messages related to their excessive number :-)

Anyway, this is probably a quite simple resource-freeing problem, yet it
gives me a lot of hassle. I'd be muchly grateful if anyone could help.

G -


Jul 19 '05 #1
1 9946
VC
Hello,

"Guillaume Mallet" <fr*******@libertysurf.fr> wrote in message
news:c5**********@news-reader5.wanadoo.fr...
Hi,

Version : Oracle 8.1.7.0.0

I'm running a batch application that basically performs a potentially high
number of SELECT queries (a minor proportion of UPDATEs as well), using the OCI.
After some 300 statements get executed, I'm faced with the recurrent
ORA-01000 error message that says "maximum open cursors exceeded". I checked my OCIHandleFree() calls, there's no mismatch, meaning they match the calls to OCIHandleAllocate().

My understanding is that to close cursors, you have to
- either let go of the connection, which i don't want to do because it'd be way too costly for me to open and close a connection on each request,
- or as it says in the online documentation "explicitly close any open
cursor during the execution of (my) program".

After some amount of searching through documentation, my question is : how
on earth do I explicitly close an open cursor ?
In OCI8, the cursor is closed by:

OCIHandleFree(stmthp, OCI_HTYPE_STMT);

However, the cursor will be not be closed immediately but on a subsequent
round-trip to the server.
If the result set is exhausted by OCIStmtFetch, the cursor is closed
automatically.
In some releases of 8i, there was a bug causing cursor leak but it should
not exhibit itself under 8.1.7.4 and above.

What leaves me somewhat perplexed is that i came across the following
statement somewhere else in the online help : "Oracle 8i does not use
cursors any more". Well my impression is that it jolly well does, if only to issue error messages related to their excessive number :-)
For some reason, the nice folks at Oracle decided to use the word
"statement" ( in OCI8) instead of "cursor" which, uderstandably, causes a
lot of confusion, but you are right, of course, it's still the same old
cursor.

Anyway, this is probably a quite simple resource-freeing problem, yet it
gives me a lot of hassle. I'd be muchly grateful if anyone could help.


If you are quite quite sure about the handles being freed properly in your
code, then it must be the bug in Oracle I mentioned above. Unfortunately,
I do not remember its number. Tne number may not be important anyway
because the only "solution" Oracle was able to come up with was upgrading to
8.1.7.4. and you might want to do it anyway to fix a host of other bugs.
VC
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Alban Hertroys | last post by:
Oh no! It's me and transactions again :) I'm not really sure whether this is a limitation of psycopg or postgresql. When I use multiple cursors in a transaction, the records inserted at the...
0
by: Rahul Sachan | last post by:
Dear All, We are using Oracle 9i databse and Oracle JDBC Driver version - 9.0.2.0.0(oracle.jdbc.driver.OracleDriver) with JDBC 2.0. 1) The following block of statement returns 0 when executed....
22
by: T.S.Negi | last post by:
Hi All, I want to avoid using cursors and loops in stored procedures. Please suggest alternate solutions with example (if possible). Any suggestion in these regards will be appreciated. ...
6
by: Tor Heigre | last post by:
Hello While testing our code on DB2 we have encountered a difference in the behaviour of DB2Driver (com.ibm.db2.jcc.DB2Driver with driverType= 4) compared to the drivers offered by Oracle 9i and...
6
by: a | last post by:
Hello, I am doing some multithreading in an MDI app, and I can't seem to get the cursor to stay as an Hourglass. I call: Cursor.Current = cursors.wait at the beginning of my routing, and...
10
by: Just Me | last post by:
Does Me.Cursor.Current=Cursors.WaitCursor set the current property of Me.Cursor to Cursors.WaitCursor And Me.Cursor.Current=Cursors.Default set the Me.Current property to something (default)...
7
by: H. Williams | last post by:
I know the .Net Cursor class doesn't work with color cursors. So I'm currently using the LoadCursorFromFile API with reflection to set color cursors: here is my code: public static extern...
1
by: Dima Kuchin | last post by:
Hello, I was trying to find the information about when and where should I use cursors in DB2, no luck. Maybe you can point me to some article that describes just that (or tell me which page is...
1
by: Guillaume Mallet | last post by:
Hi, Version : Oracle 8.1.7.0.0 I'm running a batch application that basically performs a potentially high number of SELECT queries (a minor proportion of UPDATEs as well), using the OCI....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.