Open cursors are NOT closed only by closing the ResultSet or Statement

I've realised that the open cursors are only closed by closing the connection.
In my example code I have for-loop with a vector of table-names. For every table-name I start a query to retrieve metainformation (row-size, column-names). Although I close the ResultSet (which automatically closes the PreparedStatement/Statement) I reached after the 150th loop a max-cursor-exception (ora-01000) ?!
It seems that there is only the workaround to close and re-open the connection at the end of the for-loop. Which is performance-side pretty bad :-(.
Is there really no other solution?
Besides: does anyone know WHY the statement.close() also closes the ResultSet?? I think this is a bad design (hence to tight dependency between both classes). What if the garbage collector closes the statement (and hence to the JDOC the statement.close()-method also closes the ResultSet)? For example if a method uses a local Statement and returns a ResultSet (and the Statement-garbage is collected), then the ResultSet would cause an exception?!
Thanks for the help in advance
Tai

I've realised that the open cursors are only closed by
closing the connection.Or by closing the Statement!
In my example code I have for-loop with a vector of
table-names. For every table-name I start a query to
retrieve metainformation (row-size, column-names).
Although I close the ResultSet (which automatically
closes the PreparedStatement/Statement) I reached
after the 150th loop a max-cursor-exception
(ora-01000) ?!Closing the ResutSet does not automatically close the PreparedStatement/Statement.
>
It seems that there is only the workaround to close
and re-open the connection at the end of the for-loop.
Which is performance-side pretty bad :-(.
Is there really no other solution?
Just explicitly close the PreparedStatement/Statement!
Besides: does anyone know WHY the statement.close()
also closes the ResultSet?? You need to think of a resultset as a live connection to the database.
Consider SELECT * FROM ABIGTABLE, it would be inefficient to populate the Resultset with all of the rows (could even eat up all memory) so the first n rows are returned ( n = Statement.getFetchSize() ) and the next n rows are returned as needed.
I think this is a bad
design (hence to tight dependency between both
classes). What if the garbage collector closes the
statement (and hence to the JDOC the
statement.close()-method also closes the ResultSet)?
For example if a method uses a local Statement and
returns a ResultSet (and the Statement-garbage is
collected), then the ResultSet would cause an
exception?!You should use a statment and resultset, read all your data into a collection or a CachedRowSet (http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow.html) then close the statment as soon as possible. Never return a resultset form your data tier: that is tight coupling between the tiers of your application!

Similar Messages

  • Cursors are not closed when using Ref Cursor Query in a report  ORA-01000

    Dear Experts
    Oracel database 11g,
    developer suite 10.1.2.0.2,
    application server 10.1.2.0.2,
    Windows xp platform
    For a long time, I'm hitting ORA-01000
    I have a 2 group report (master and detail) using Ref Cusor query, when this report is run, I found that it opens several cursors (should be only one cursor) for the detail query although it should not, I found that the number of these cursors is equal to the number of master records.
    Moreover, after the report is finished, these cursors are not closed, and they are increasing cumulatively each time I run the report, and finally the maximum number of open cursors is exceeded, and thus I get ORA-01000.
    I increased the open cursors parameter for the database to an unbeleivable value 30000, but of course it will be exceeded during the session because the cursors are increasing cumulatively.
    I Found that this problem is solved when using only one master Ref Cursor Query and create a breake group, the problem is solved also if we use SQL Query instead of Ref Query for the master and detail queries, but for some considerations, I should not use neither breake group nor SQL Query, I have to use REF Cursor queries.
    Is this an oracle bug , and how can I overcome ?
    Thanks
    Edited by: Mostafa Abolaynain on May 6, 2012 9:58 AM

    Thank you Inol for your answer, However
    Ref Cursor give me felxibility to control the query, for example see the following query :
    function QR_1RefCurDS return DEF_CURSORS.JOURHEAD_REFCUR is
    temp_JOURHEAD DEF_CURSORS.JOURHEAD_refcur;
              v_from_date DATE;
              v_to_date DATE;
              V_SERIAL_TYPE number;
    begin
    SELECT SERIAL_TYPE INTO V_SERIAL_TYPE
    FROM ACC_VOUCHER_TYPES
    where voucher_type='J'
    and IDENT_NO=:IDENT
    AND COMP_NO=TO_NUMBER(:COMPANY_NO);
         IF :no_date=1 then
                   IF V_SERIAL_TYPE =1 THEN     
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
                   AND IDENT=:IDENT
              AND ((TO_NUMBER(VOCH_NO)=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
              OR (TO_NUMBER(VOCH_NO) BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
              OR (TO_NUMBER(VOCH_NO)<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
              OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))
                   ORDER BY TO_NUMBER(VOCH_NO);
                   ELSE
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
                   AND IDENT=:IDENT               
              AND ((VOCH_NO=:FROM_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NULL)
              OR (VOCH_NO BETWEEN :FROM_NO AND :TO_NO and :FROM_NO IS NOT NULL AND :TO_NO IS NOT NULL )
              OR (VOCH_NO<=:TO_NO and :FROM_NO IS NULL AND :TO_NO IS NOT NULL )
              OR (:FROM_NO IS NULL AND :TO_NO IS NULL ))     
                   ORDER BY VOCH_NO;          
                   END IF;
         ELSE
                   v_from_date:=to_DATE(:from_date);
                   v_to_date:=to_DATE(:to_date);                         
              IF V_SERIAL_TYPE =1 THEN
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
              AND IDENT=:IDENT                         
                   AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
                   OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
                   OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
                   OR (:from_date is null and :to_date is null ))     
                   ORDER BY VOCH_DATE,TO_NUMBER(VOCH_NO);     
              ELSE
                   open temp_JOURHEAD for select VOCH_NO, VOCH_DATE
                   FROM JOURHEAD
                   WHERE COMP_NO=TO_NUMBER(:COMPANY_NO)
                   AND IDENT=:IDENT                         
              AND ((voch_date between v_from_date and v_to_date and :from_date is not null and :to_date is not null)
                   OR (voch_date <= v_to_date and :from_date is null and :to_date is not null)
                   OR (voch_date = v_from_date and :from_date is not null and :to_date is null)
                   OR (:from_date is null and :to_date is null ))     
                   ORDER BY VOCH_DATE,VOCH_NO;          
              END IF;
         END IF;               
         return temp_JOURHEAD;
    end;

  • My open tabs are not being remembered when I close and re-open Firefox 4 even though I selected this feature in Options.

    My open tabs are not being remembered when I close and re-open Firefox 4 even though I selected this feature in Options. Can anyone tell me why?

    App tabs and Tab Groups (Panorama) are stored as part of the session data in the file sessionstore.js in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder]
    * http://kb.mozillazine.org/Session_Restore
    Make sure that you do not use [[Clear Recent History]] to clear the "Browsing History" if Firefox is closed.

  • Reg: Certain Open Items are not showing in open item clearing F-44

    HI all,
    I want clear open items using with f-44 but cetain open items are not showing in opeing item clearing.   i checked in FBL1N all open items are shwoing i want see all open items inf-44 how to see plz help me
    with regards
    JK Rao

    Hi,
    Check whether you r giving some additional selection take it as none and are the items in the account have any special indicator  you might not be giving here.
    reward pts if useful
    regds

  • On firefox clickable buttons are not clickable for me eg the + to open new tab ,the sign in . register and other applications buttons on this page wont click yet the 2 blue change buttons are fine

    Question
    on firefox clickable buttons are not clickable for me eg the + to open new tab ,the sign in . register and other applications buttons on this page wont click yet the 2 blue change buttons are fine

    Top of Firefox window non-responsive, toolbars non responsive -- also see [http://kb.mozillazine.org/Problematic_extensions Problematic extensions]
    *caused by Yahoo Toolbar -- https://support.mozilla.com/questions/890908
    *caused by Babylon Toolbar -- https://support.mozilla.com/questions/890670

  • When deleting a user created folder from On My Mac in Mac Mail the sent messages that are part of conversations that reside there are not deleted, only the received mail gets deleted.

    When deleting a user created folder from On My Mac in Mac Mail the sent messages that are part of conversations that reside there are not deleted, only the received mail gets deleted. Any way for both the received and sent mail that resides there to be deleted?
    I create a lot of project folders where i keep all my conversations regarding the project. Once the project is finished i would like to just delete the folder and get rid of all the emails associated with it but when i delete the folder i've noticed that only received messages are deleted. Now I am stuck trying to sort through my sent folder for messages that were returned there after the conversations was supposedly deleted.

    Mail/Preferences/Viewing - un-check include related messages, delete the folder, then go back and reset yo include.

  • Cannot use icloud tab option on ipad and iphone as the open tabs are not listed.

    cannot use icloud tab option on ipad and iphone as the open tabs are not listed.

    just checked everything through and this is deffinately the public beta of iCloud as it simlily doesnt come up in the  settings of ipad or iphone. However the current firmware i am using isnt an itunes download, as i have downgraded and all itunes synced apps onto both the iPad and iphone crash when i open them, is this because i have downloaded the firmware from a third party? i have treble checked that the firmware is NOT hacked and is just a host's official apple firmware, so i cannot understand why this problem is occuring?

  • TS4057 I did this and now my videos are not working. They show the pictures aren't there on some and on others it shows they are there, but doesn't show them in the player. When I try to Share anything it just says Waiting for Processing for hours. What d

    I did this and now my videos are not working. They show the pictures aren't there on some and on others it shows they are there, but doesn't show them in the player. When I try to Share anything it just says Waiting for Processing for hours. What do I do?
    I also got Motion and can't figure out how to use it with Final Cut Pro X. Any help woud be great. Thanks

    I have no idea what may have caused your MacBook to stop working, but from your description it kind of sounds like it may have started before you ran Software Update and installed the new Apps. Just the general slow feeling and bugginess is what tips me off. You said that you weren't sure if you had closed all open windows, that doesn't matter if the computer restarts itself. It automatically closes all other open applications when restarting.
    As to your data being retrievable, if when you take it in they do a fresh install of the OS, then no, it will not be unless you want to pay several thousand dollars to a software retrieval company.
    I am glad to hear that you have taken into the Apple Store to get it fixed, and that you have all of your purchased music backed up to your iPod. You should be able to just transfer it all back to iTunes once you get your computer back should it be necessary.
    As a side note, the proper place for this topic would probably in the MacBook forums, not iTunes since there is no evidence that iTunes started the issue.

  • SSRS 2008 Column Chart with Calculated Series (moving average) "formula error - there are not enough data points for the period" error

    I have a simple column chart grouping on 1 value on the category axis.  For simplicity's sake, we are plotting $ amounts grouping by Month on the category axis.  I right click on the data series and choose "Add calculated series...".  I choose moving average.  I want to move the average over at least 2 periods.
    When I run the report, I get the error "Formula error - there are not enough data points for the period".  The way the report is, I never have a guaranteed number of categories (there could be one or there could be 5).  When there is 2 or more, the chart renders fine, however, when there is only 1 value, instead of suppressing the moving average line, I get that error and the chart shows nothing.
    I don't think this is entirely acceptable for our end users.  At a minimum, I would think the moving average line would be suppressed instead of hiding the entire chart.  Does anyone know of any workarounds or do I have to enter another ms. connect bug/design consideration.
    Thank you,
    Dan

    I was having the same error while trying to plot a moving average across 7 days. The work around I found was rather simple.
    If you right click your report in the solution explorer and select "View Code" it will give you the underlying XML of the report. Find the entry for the value of your calculated series and enter a formula to dynamically create your periods.
    <ChartFormulaParameter Name="Period">
                      <Value>=IIf(Count(Fields!Calls.Value) >= 7 ,7, (Count(Fields!Calls.Value)))</Value>
    </ChartFormulaParameter>
    What I'm doing here is getting the row count of records returned in the chart. If the returned rows are greater than or equal to 7 (The amount of days I want the average) it will set the points to 7. If not, it will set the number to the amount of returned rows. So far this has worked great. I'm probably going to add more code to handle no records returned although in my case that shouldn't happen but, you never know.
    A side note:
    If you open the calculated series properties in the designer, you will notice the number of periods is set to "0". If you change this it will overwrite your custom formula in the XML.

  • I bought a used PowerMacPC G5. I can burn and read DVDs, but I can't read or burn CDs. The CDs are not even recognized. After the drive searches for a while, the CD is ejected without any error messages. The CDs work okay on my iMac.

    I bought a used PowerMacPC G5. I can burn and read DVDs, but I can't read or burn CDs. The CDs are not even recognized. After the drive searches for a while, the CD is ejected without any error messages. The CDs work okay on my iMac.
    I am running Mac OSX 10.4.11. According to the System profiler the CD/DVD drive is a "PioneerDVD-RWDVR-112D." When I compare the information under this heading, the only unusual difference from my iMac is that the G5 reads "Burn Support: Yes (Unsupported)." My iMac reads "Burn Support: Yes (Apple Shipping Drive)."
    Under the System Preferences the options are set to "Ask what to do" when a blank CD or DVD is inserted. Music CD set to open iTunes, Picture CD set to open iPhoto, Video DVD set to open DVD player.
    Do you have any suggestions?
    Thanks, Jack

    Hi Jack, great help so far!
    Internal...
    http://eshop.macsales.com/static_pages/Framework.cfm?page=superdrive/sdl_powerma c_g5.html
    External be sure it's Firewire & not Bus powered...
    http://eshop.macsales.com/shop/firewire/optical-drives/

  • Features that are not supported by Excel in the browser and interactive reports will be removed from the saved copy

    I Created a power view in Excel 2013 and uploaded to my Power BI for o365 site.
    But when i click on my excel file it opens in browser,After that i click on File tab its showing me two option 
    1. Save a Copy
    2.Download a copy
    When i click on save a copy its showing me an warning below
    Features that are not supported by Excel in the browser and interactive reports will be removed from the saved copy.
    Continue with Save?
    If i continue saving it only saves an excel files with data only not the power view which i want to save with applied filters.
    Please help me for this

    Just to clarify, when you hit the option of Save As Copy, the whole experience goes into a "read-write" mode in Excel services, which currently doesn't support authoring, just consumption of PowerView sheets.
    Two mitigations that come to mind:
    1. Download the copy (as Brad suggests), rename the file and upload.
    2. Use the send to option of SharePoint online, give the file the right target document library (can be the same as source) and rename the file:
    GALROY

  • After updating my iPhone 4 to iOS7, the controls on the headset are not working anymore. However, the controls are working on my friend's iPhone 5. Is this a common issue?

    After updating my iPhone 4 to iOS7, the controls on the headset are not working anymore. However, the controls are working on my friend's iPhone 5. Is this a common issue?

    ofel wrote:
    After updating my iPhone 4 to iOS7, the controls on the headset are not working ..
    Try This...
    Close All Open Apps... Sign Out of your Account... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...

  • My apps are not being updated when pressing the update all button. It just says installing and no update is being done., my apps are not being updated when pressing the update all button. It just says installing and no update is being done.

    my apps are not being updated when pressing the update all button. It just says installing and no update is being done., my apps are not being updated when pressing the update all button. It just says installing and no update is being done.

    Must be serious because you have stated the problem 4 times now.
    Here are a number of things that you can try and maybe one of them will help.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    Make sure that you do not have a stalled download in iTunes - a song or podcast .... if you have a download in there that did not finish, complete that one first. Only one thing can download at a time on the iPad so that could be what is causing the problem.
    If that doesn't work - sign out of your account, restart the iPad and then sign in again.
    Settings>iTunes & App Store>Apple ID. Tap your ID and sign out. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Go back to Settings>iTunes & App Store>Sign in and then try to update again. Tap one waiting icon only if necessary to start the download stream.
    You can also try deleting the waiting icons - tap and hold down on an icon until it wiggles - the tap the X on the icon to delete it. Then try to download again.
    You can try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your app preferences and device settings again.
    You can also try going to the App Store, find an app that needs an update, tap on the app icon to bring up the description page, then tap on install that way, rather than using the Update option from the app updates screen.
    And ... You can always install the updates in iTunes on your computer and then sync them to the iPad.

  • You are not authorized to logon to the target system error code1(in SM58)

    Hi Basis Gurus,
    In my test system Idocs are in error status.
    When I check tRFC monitering in SM58, there are several Idocs are strucked.
    Status Text: You are not authorized to logon to the target system  (error code 1).
    Recently we have refreshed our test system with production data.
    Before system refresh it was normal.
    The RFC connection is also working fine.
    Please suggest the solution as I'm struck in this issue.
    I'm a Basis Guy.
    Thanks & Regards,
    Ravi.

    Hi,
    Change the RFC user password in target system however there are 2 tests to analyse from SM59 :
    1) RFC Connection test
    2) Authorization Test
    And i guess you have only tested the 1st one from the RFC(SM59) check whether you can succeed with option 2 if not then you may need to change the password.
    Thanks,
    Salim

  • Serbian characters š,đ,č,ć,ž are not included in most of the fonts

    Serbian characters are not included in most of the fonts in Adobe products and its bad for creativity. I wonder what can I do to change this? Where to start? Any advice?

    Your kindness has inspired me to write this article
    http://bzivkovicsavke.blogspot.com/2010/11/adobe-systems-incorporated-je-prijatelj.html
    . Although we do not understand Serbian language, you can translate it into
    Google.
    Bojan Živković Savke
    My profiles:  <http://picasaweb.google.com/home>
    Picasa<http://picasaweb.google.com/home>
    <http://wiki.answers.com/Q/User:Savke>
    Answers.com<http://wiki.answers.com/Q/User:Savke>
    <http://bzivkovicsavke.blogspot.com/>
    Blogger<http://bzivkovicsavke.blogspot.com/>
    <http://www.creemaginet.com/sajt/blog/6302> Blog
    RSS<http://www.creemaginet.com/sajt/blog/6302>
    Contact me: image: Skype/ bojan-zivkovic
    Signature powered by
    <http://www.wisestamp.com/email-install?utm_source=extension&utm_medium=email&utm_campaign= footer>
    WiseStamp<http://www.wisestamp.com/email-install?utm_source=extension&utm_medium=email&utm_campaign= footer>
    2010/11/9 Chris Cox <[email protected]>
    Yeah, most of those are not Adobe fonts and don't come with the Creative
    Suite or Photoshop.
    >
    >
    Right now, it appears that only our most recent fonts have complete Serbian
    glyphs:
    Garamond Premier Pro, Hypatia Sans Pro, Arno Pro, Minion Pro, Myriad Pro,
    Sava Pro, and Warnock Pro.
    >
    Our type team has said that all of our fonts going forward will have
    Serbian glyphs.
    >

Maybe you are looking for

  • Legalities of color-and why are my RGB values inconsistent?

    Hi there, I have a client who is trying to trademark their logo and the RGB values. I have sent them the files and corresponding RGB values, but when they check the files in their mac Digital Color Meter they come up with different values. On my own

  • How to apply signed patches to Studio 11 under Solaris 10?

    I'm running Solaris 10 6/06 on a Sun W2100z (x86_64) workstation. I have a long history of experience with Solaris, but I'm not terribly familiar with the things that are new or different with 10, including zones and the new patch management tools. I

  • Acts of stock in base of material transaction code.

    Hey Guys! I wonder that how we can reach acts of stock in base of materials? And also i want to see unit price in every materail. What can be transaction code for this solution? May be,you can tell another alternative solution. All the best with you!

  • I lost my design time pages! - urgent

    OK, I did a not so smart thing. I had created a page group, and I was trying to set it as the home page for general users. I went into global settings and changed the home page to my page group root page. I no longer have access to Edit or Navigate o

  • Update Recv.Point of an Item in Delivery

    Hi Experts, I need to update the Ext.Delivery(LIKP-LIFEX), Recv.Point(LIPS-EMPST) for a Delivery.  Is there any FM through which we can update these two fields. I found the BAPI BAPI_INB_DELIVERY_CHANGE thorough which we can update the Ext.Delivery.