Reputation: 445
As I know, the statement object for scroll-able ResultSet is obtained as below.
Statement statement = connection.createStatement(P1, P2);
Here P1 may take
ResultSet.TYPE_SCROLL_SENSITIVE
ResultSet.TYPE_SCROLL_INSENSITIVE
And P2 may take
ResultSet.CONCUR_READ_ONLY
ResultSet.CONCUR_UPDATABLE
SCROLL_SENSIVITE or INSENSITIVE indicates, whether the updation of ResultSet will affect the actual database or Not. (Kind of READ_ONLY or Updatable)
So both the parameters are kind of similar and I feel like they are implemented for same purpose.
How are they different or I am missing something here?
Upvotes: 1
Views: 768
Reputation: 73558
The second parameter CONCUR_*
determines whether you can modify the database through the ResultSet
. TYPE_SCROLL_(IN)SENSITIVE
determines whether modifications made to the underlying rows are seen by you while scrolling the ResultSet
. So INSENSITIVE
provides a "snapshot" view to the results, they'll never change. SENSITIVE
provides a "live" view, so if you're scrolling the results for a long time you can see very different values than what was originally returned by the query.
Related, but they're "opposite sides".
Upvotes: 5