Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Posts
    3

    Unanswered: java stored procedures leaves open cursors?

    Hi,
    I have a problem when a java stored procedure (SP) is called from C++ client (embedded SQL):
    The SP returns one resultset. As the version of embedded SQL we use cannot call a SP that returns a resultset, I coded an other Java SP that calls the first one and 'consumes' the produces resultset. Here 'call' means not a JDBC call, it means that the Java code of the first SP is instanciated and executed.

    When calling this 'Wrapper SP' from Java via JDBC, everything works fine. But when calling it from the C-code, the first call works, but the following calls are producing an open cursor error:

    SQL0519N The PREPARE statement identifies the SELECT or VALUES statement of the open cursor "SQLCUR382". SQLSTATE=24506

    The statement that produces this error has nothing to do with the resultset finally returned. It is just used internally for preparation.

    So, can somebody tell me:
    - does this kind of wrapping of SPs work at all

    - how to work with statements (select, inserts), that are just used within the Stored Procedure (closing, set to null)


    My environment:
    DB2 V7.1 FP6 on WinNT, JDK 1.3.1

    Thanks,
    Oliver

  2. #2
    Join Date
    Aug 2002
    Posts
    35

    Re: java stored procedures leaves open cursors?

    Hi,

    We had the same issue like that the problem with open cusrsor is
    once you call the stored procedure you are not closing the cursor .
    WHat you ahve to do is just after the call you have to cpy that result set into some local or working storage and close the cusror that reslovesyour issue. I think you can call Java tored procedures from C++ I would to know why you are not can you please sedn more deatils.

    Any questions let me know.

    Thanks,
    vasu,
    Tech Architect











    Originally posted by obert
    Hi,
    I have a problem when a java stored procedure (SP) is called from C++ client (embedded SQL):
    The SP returns one resultset. As the version of embedded SQL we use cannot call a SP that returns a resultset, I coded an other Java SP that calls the first one and 'consumes' the produces resultset. Here 'call' means not a JDBC call, it means that the Java code of the first SP is instanciated and executed.

    When calling this 'Wrapper SP' from Java via JDBC, everything works fine. But when calling it from the C-code, the first call works, but the following calls are producing an open cursor error:

    SQL0519N The PREPARE statement identifies the SELECT or VALUES statement of the open cursor "SQLCUR382". SQLSTATE=24506

    The statement that produces this error has nothing to do with the resultset finally returned. It is just used internally for preparation.

    So, can somebody tell me:
    - does this kind of wrapping of SPs work at all

    - how to work with statements (select, inserts), that are just used within the Stored Procedure (closing, set to null)


    My environment:
    DB2 V7.1 FP6 on WinNT, JDK 1.3.1

    Thanks,
    Oliver
    vasu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •