close the cursor when using ADODB RRS feed

  • Question

  • Hi All,

    I am running into an issue where my application is running a bunch of sql query to create and push few records to Oracle DB.

    All the queries are being read from a file. After reading all the query, we are executing them one by on using ADODB execute.

    All these queries are only create/insert operation so we are not using recordset. Now after running few queries, it throws ORA error open cursors exceeded. 

    I googled and found that it is happening because of cursor leaks and we must close all the cursor after each query is executed. 

    I am not finding any way to close the cursor after executing the sql statement using Adodb. 

    Some code snippet :

    private dba As ADODB.Connection dba = new ADODB.Connection

    Dim Idx As Integer
    For Idx = 0 To 5000
        CommandSQL = SQLAry(Idx)


    Next Idx

    After running couple of queries, it fails with above error.

    Please provide some suggestion.

    Wednesday, September 4, 2019 7:21 AM

All replies

  • Hi Nihal_dev,

    This issue is related to the setting of the database. Here is the link I found may help you.

    Troubleshooting Open Cursor Issues.



    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 5, 2019 1:59 AM