× 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 29-May-2015 07:53 -0500, Kerins, Rebecca R. wrote:
I am currently creating a program using Scott's JDBCR4 program to
retrieve unprocessed records from a db2 database on an AIX box. I am
using SQL statements to retrieve the records and then I'm processing
them in our legacy system using RPG and updating files on the
iSeries. To do this I am looping thru the db2 database and that is
working.

What I need to do at the end of the select is update the record
selected with a status of "Processed" or "Error". I am not quite
sure how to do this. I know there is a select for update SQL command
but can that be used with the JDBC4?

Pseudo Code:

1 Select unprocessed record from db2 database.
2 Process record on iSeries.
3 Update status on record from db2 database.
4 Go to step 1.

Any ideas you have would be appreciated.


I am unsure if JDBCR4 has support for updating via cursor, but some JDBC doc does seem to suggest there is support for that, via the ResultSet object:
<https://docs.oracle.com/javase/tutorial/jdbc/basics/retrieving.html#rs_update>
_Updating Rows in ResultSet Objects_

If there are no worries that the DB2 for AIX [DB2 LUW] would be replaced by another database, then probably easiest to just code embedded SQL to use CONNECT and a cursor to enable UPDATE ... WHERE CURRENT OF, rather than using [the IMO much clunkier interface of] JDBC to get the work done.

And FWiW, a web search on JDBC and CURSOR gave another hit, which [was interesting to me, as that Derby doc] shows another apparent use of JDBC that implies enabling of the WHERE CURRENT OF clause:
<https://db.apache.org/derby/docs/10.0/manuals/develop/develop66.html#HDRSII-CONCEPTS-28351>


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.