3 Replies Latest reply on Jun 10, 2014 4:43 PM by Ed Heeren-Oracle

    DB-Cursor is closed after tpcall, but remains open after tpcall with NOTRAN-Flag

    user6220251

      Hello,

       

      I face the following situation:

      1. A Tuxedo-Client "C"
        1. calls tpbegin
        2. calls a subprogramm
        3. calls tpcommit
      2. The subprogramm
        1. opens a cursor for DB2
        2. in a loop it
          1. issues a fetch
          2. calls a Tuxedo server "S" with tpcall
      3. The Tuxedo server "S" is part of the global transaction, but in the current situation "S" does not issue any DB-operation

       

      The second fetch delivers SQLCODE 501, which means: cursor is not opened.

       

      But if the tpcall to "S" is done with NOTRAN set everything is ok, the cursor is still open after the tpcall.

       

      My questions are:

      1. Is it possible, that the tpcall closes the cursor?
      2. If yes: why is this done? What can I do?
      3. If not: any other ideas why the cursor may be closed in this sutuation?

       

      Thanks for your help.

       

      Georg

        • 1. Re: DB-Cursor is closed after tpcall, but remains open after tpcall with NOTRAN-Flag
          Todd Little-Oracle

          Hi Georg,

           

          What does your OPENINFO string look like for the group the server is in?  And how are you building the client?  Are you passing the -r switch to buildclient?  Is the client a native client or workstation client?

           

          It sounds like a DB2 problem, but let's see the details of the above questions first.

           

          Regards,

          Todd Little

          Oracle Tuxedo Chief Architect

          • 2. Re: DB-Cursor is closed after tpcall, but remains open after tpcall with NOTRAN-Flag
            user6220251

            Hi Todd,

             

            the client is a native client, it is built with buildclient, the -r parameter is used.

             

            The OPENINFO in the Tuxedo config file is:

            OPENINFO="UDB_XA:db=###DB_DATABASE###,uid=###DB_USER###,pwd=###DB_PW###"

             

            ###xxx### are placeholders.

             

            Thanks for looking at my question.

             

            Georg

            • 3. Re: DB-Cursor is closed after tpcall, but remains open after tpcall with NOTRAN-Flag
              Ed Heeren-Oracle

              Georg,

               

              I'm not sure what is happening in your application, but it could be related to the DB2 SUSPEND_CURSOR option, which is documented at IBM Knowledge Center

              This "Specifies whether cursors are to be kept when a transaction thread of control is suspended. Valid values are T, F, or no value. TP monitors that suspend a transaction branch can reuse the suspended thread or process for other transactions. If SUSPEND_CURSOR is off, all cursors except cursors with hold attributes are closed. On resumption of the suspended transaction, the application must obtain the cursors again. If SUSPEND_CURSOR is on, any open cursors are not closed, and are available to the suspended transaction on resumption. A value of T means that SUSPEND_CURSOR is on; a value of

              F means that SUSPEND_CURSOR is off; This parameter can be used to override the setting derived from a specified TPM value. If this parameter is not specified, the default value of F is used."

              Although you don't specify this parameter in your OPENINFO and the default is "F", perhaps there could be some other way for the DB administrator to override this value.  You may want to experiment with "DECLARE xxxx CURSOR WITH HOLD" in your program to see if the WITH HOLD clause will produce the desired behavior.

              Regards,

              Ed