Invalid Cursor - Methods to trace the error?

General discussion forum about all databases other than SqlBase.
OeavDev
Austria
Posts: 82
Joined: 15 May 2018, 11:18
Location: Vienna

Invalid Cursor - Methods to trace the error?

Post by OeavDev » 12 Jan 2017, 11:02

Hi,

one of our customers randomly gets an invalid cursor error in our software (oracle 11 database): Is it possible to get the name of the invalid cursor programmatically? What is the simplest solution to trace such errors?

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2370
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Invalid Cursor - Methods to trace the error?

Post by Jeff Luther » 12 Jan 2017, 18:39

Well, assuming the error is coming from within your application, then you can trap and process the error details with SAM_SqlError in Appl. Actions, or locally in When SqlError.

Once your code is there, then use the TD SqlErrorXXX and SqlExtractArgs functions to get details about the cursor, and so on. Sounds like perhaps the cursor/handle wasn't connected before being used in a Sql command.
Jeff Luther @ PC Design
Palm Springs, California

OeavDev
Austria
Posts: 82
Joined: 15 May 2018, 11:18
Location: Vienna

Re: Invalid Cursor - Methods to trace the error?

Post by OeavDev » 13 Jan 2017, 10:32

I also had this idea. But unfortunately the SAM_SqlError message is not fired.

You may take a look at my code sample.
You do not have the required permissions to view the files attached to this post.

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2370
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Invalid Cursor - Methods to trace the error?

Post by Jeff Luther » 13 Jan 2017, 18:53

unfortunately the SAM_SqlError message is not fired.
I see this too. I back-converted to v5.2 & v4.2 (I first ran your test in v6.3) and see the same issue. It seems that TD is treating that SqlExecute() call in a special way and ignoring the local When SqlError and immediately calling its default error processing. Just a guess, but calling SqlExecute() by itself isn't correct coding, either.


If you run my attached mod. to your test, where I first would call SqlConnect() instead, then the code works as you've written it. The local When SqlError code is first called. Then because you do not have a Return TRUE/FALSE in that code, TD next runs your global SAM_SqlError code. And with no Return T/F in that code last TD's own default internal processing is called.
You do not have the required permissions to view the files attached to this post.
Jeff Luther @ PC Design
Palm Springs, California

OeavDev
Austria
Posts: 82
Joined: 15 May 2018, 11:18
Location: Vienna

Re: Invalid Cursor - Methods to trace the error?

Post by OeavDev » 16 Jan 2017, 07:17

Thanks for your explanations. I'll have a look into it.

(BTW: I know, that I should connect to database before calling SQLExecute() ;-)

FRBhote
India
Posts: 2204
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Invalid Cursor - Methods to trace the error?

Post by FRBhote » 16 Jan 2017, 13:02

Invalid Cursor means the cursor is not connected - has a null value. So no chance of SAM_SqlError. Virtually no way of finding it.

Also happens when the server is down or not pinging - the cursor has a value - but no server.

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 1 guest