× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 25-Jan-2012 17:07 , James Lampert wrote:
It seems that I have what is starting to look very much like the
Environment, Connection, and Statement handles in an RPG program
that calls SQLCLI are being randomly and intermittently invalidated.
Does anybody know what could cause this, or how to check the validity
of them?

Accidental freeing or allocating requests? In my experience, the validity is detected upon use; i.e. SQL_INVALID_HANDLE occurs for an invalid handle passed as input to one of the API calls. In a similar issue I used debug to review every SQLAlloc and SQLfree to correlate each allocation to each use of a handle until through the free\release.

A discussion with a similar issue to what I had, and even a similar origin to what Jeff noted as, paraphrased, "copied line of code that was not correctly updated":
"Subject: SQL CLI Help"
http://archive.midrange.com/rpg400-l/200607/msg00329.html

FWiW I had used the "Example" in the following documentation as my starting point:
_i Interactive SQL and the equivalent DB2 UDB CLI function calls i_
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/cli/rzadpxminter.htm

Other doc references that may be of value:

KB document number 18370758
_i OS/400 and i5/OS SQL CLI (ODBC) Documentation and FAQs i_
http://www-912.ibm.com/s_dir/SLKBase.nsf/1ac66549a21402188625680b0002037e/bb0611c71924a05586256865006e20e8?OpenDocument

_i Debug CLI i_
http://publib.boulder.ibm.com/iseries/v5r1/ic2924/tstudio/db2_400/CLI/Cli.htm
" ...
SQL_INVALID_HANDLE
http://publib.boulder.ibm.com/iseries/v5r1/ic2924/tstudio/db2_400/CLI/datinv.htm
'SQL_INVALID_HANDLE
SQL_INVALID_HANDLE means the function failed due to an invalid input handle (environment, connection, descriptor, or statement handle) in the user's application. Check the sequence of the user's application, verify all parameters, and make sure all errors are handled. SQLError() will not return any information because the statement could not even be attempted, and so it could not generate any information.'
...
"

_i Stored Procedures, Triggers, and User-Defined Functions on DB2... i_
www.redbooks.ibm.com/redbooks/pdfs/sg246503.pdf

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.