How can I tell if the data I get from a default ResultSet reflects changes since the time the query was executed but not yet retrieved?

Joe Sam Shirah

You can't, with complete confidence. That's because some ResultSets ( those that need to be sorted, for example ) require the creation of temporary tables using a data snapshot. However, those that can effectively read along an index can be checked for what is termed "incremental materialization" by using the DatabaseMetaData methods othersDeletesAreVisible(int type), othersInsertsAreVisible(int type) and othersUpdatesAreVisible(int type). The "type" parameter is one of ResultSet.TYPE_FORWARD_ONLY ( for a default ResultSet ), ResultSet.TYPE_SCROLL_SENSITIVE or ResultSet.TYPE_SCROLL_SENSITIVE.

Keep the initial caveat in mind: The methods will still return true ( if the DB engine is capable ) even when a sorted ResultSet is returned.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.