473,569 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 OCIHandleAlloca te().

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 9995
VC
Hello,

"Guillaume Mallet" <fr*******@libe rtysurf.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 OCIHandleAlloca te().

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(s tmthp, 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
8978
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 start of the transaction aren't visible to those later on in that transaction (using a different cursor). Attached is a simplified example (the...
0
10300
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. Is there a way to determine whether the session has actually been altered? st.executeUpdate("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD...
22
10636
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. Thanks in advance, T.S.Negi
6
4834
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 Sybase SQL Anywhere 7. Our system contains code like this (java pseudocode) Connection con = <> con.setAutoCommit(false);
6
2498
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 set it back to cursors.default when the thread ends (using a callback)
10
17316
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) stored in Me.Cursor. Or is Cursors.Default some process wide cursor shape? What is a correct statement?
7
3541
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 IntPtr LoadCursorFromFile( string fileName ); IntPtr hwdCursor= LoadCursorFromFile( "color.cur" );...
1
6685
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 it in DB2 SQL reference book, if it's there)? Or maybe you can post a short answer here, if there's no dedicated article? Another question would...
1
250
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. 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...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7968
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.