How can I ensure that my app has the latest data?

Joe Sam Shirah

Typically an application retrieves multiple rows of data, providing a snapshot at an instant of time. Before a particular row is operated upon, the actual data may have been modified by another program. When it is essential that the most recent data is provided, a JDBC 2.0 driver provides the ResultSet.refreshRow method.

Note that this can be quite expensive if the fetch size is high, causing multiple rows to be returned ( see What does setFetchSize() really do? ) and obviously causes a trip back to the server in any case. This will only work for a scrollable ResultSet requested with ResultSet.TYPE_SCROLL_SENSITIVE; the method call is ignored for other types. For more information, see 3.3.7 Getting the Most Recent Data in the Advanced Tutorial at the JDC.