×
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.
I think you're just going to have to open a new result set. JDBC doesn't really accommodate what we've come to know as record level access in RPG using SETLL and CHAIN opcodes. Creating a new result set is relatively inexpensive. Remember, you don't get every record in the query when you first create a result set with executeQuery. The driver works with the system to fetch records as you read (next()) from the result set, buffering where helpful. Rerun the statement or prepared statement with new values to create a new result set where necessary. Think of a ResultSet as kind-of-a buffered cursor. A ResultSet actually has a cursor name you can use in other query statements ("where current of " + rs.getCursorName()), but it is usually easier to use rs.updateRow().
Where performance was critical I have read a result set into a java.collections.Map object using the same keys in the map. This is only helpful if you're going to skip around many times within a small result set, rereading many records.
If you only need one specific record, include the entire key in the where clause and work with the one-record result set. If you're working through a set, use a more generic where clause (first two of three fields that comprise the primary key, for instance) and be sure to specify the order by clause or the sequence may not match what you intended.
If you really must, you can use the record-level access classes of JT400 such as com.ibm.as400.access.KeyedFile. This is *NOT* JDBC, of course.
--
Question:
I'm getting back into my JDBC/JDBCR4 project, and I'm having trouble figuring out a way to SETLL or CHAIN to a specific record by key without having to open a new result set.
Looking at the Javadoc for ResultSet, I see damn near everything BUT that.
--
JHHL
As an Amazon Associate we earn from qualifying purchases.
This thread ...
Re: JDBC equivalent to RPG SETLL or CHAIN?, (continued)
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.