|
Hello Buck, You wrote: >If I exit the program and close the cursor, I get an "invalid cursor state." Yep, because the cursor isn't open. Just like native I/O the file (cursor) has to be open before you can read (fetch) from it. >If I leave the cursor open, I can read the entire result set. Working as designed. You also have to be careful with SQL compile options to ensure the cursor is not automatically closed when the module, program, or activation group ends. >The question: Should I be using CLI instead? Any opinions on adding a >'shutdown' parameter and calling the SP again to close the cursor? The CLI won't help because the same rules apply. Stored procedures do not close the result set. The consumer of the result set (i.e., the client that called the stored procedure) is responsible for closing the result set. For example, in Java the ResultSet class has a close() method. However, in Java, it is more natural to let the ResultSet be closed automatically when the CallableStatement is closed, or when it is garbage collected. Regards, Simon Coulter. -------------------------------------------------------------------- FlyByNight Software AS/400 Technical Specialists http://www.flybynight.com.au/ Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ Fax: +61 3 9419 0175 mailto: shc@xxxxxxxxxxxxxxxxx \ / X ASCII Ribbon campaign against HTML E-Mail / \ --------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.
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.