|
Both JDBC drivers (Native and Toolbox work this way). The reason is simple, really. We do not position scrollable cursors by travelling through the whole ResultSet, we let the SQL runtime move the cursor and the database does not provide support for getting the row number. The JDBC drivers do the best they can at giving a valid row number back to the application by keeping track of how far they are positioned from the beginning and the end. Then the user does something that causes the JDBC driver to not be able to keeep track anymore, you get back 0. Here is the javadoc from the method: /** Returns the current row number. Depending on the cursor position within the result set, the current row number may not be available. Specifically, the use of last(), afterLast(), and absolute() with a negative value will make the current row number not available. @return The current row number (1-based), or 0 if there is no current row, if the cursor is positioned on the insert row, or the current row number is not known. @exception SQLException If the result set is not open. **/ public int getRow () throws SQLException { <blah> } Regards, Richard D. Dettinger AS/400 Java Data Access Team "TRUE! nervous, very, very dreadfully nervous I had been and am; but why WILL you say that I am mad? The disease had sharpened my senses, not destroyed, not dulled them. " - Edgar Allan Poe "The Tell-Tale Heart" Jerrold_Bisera@countrywide.com@midrange.com on 01/22/2001 06:03:53 PM Please respond to JAVA400-L@midrange.com Sent by: owner-java400-l@midrange.com To: JAVA400-L@midrange.com cc: Subject: Result Set using AS400 Tool box Driver I am trying to position to the last row in a result set and get the row number. However, the last() method followed by a getRow() is returning "0" and not the last row numbert of the result set. Any idea what is happening? +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +--- +--- | This is the JAVA/400 Mailing List! | To submit a new message, send your mail to JAVA400-L@midrange.com. | To subscribe to this list send email to JAVA400-L-SUB@midrange.com. | To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com. | Questions should be directed to the list owner: joe@zappie.net +---
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.