抖阴社区

TYPE_SCROLL_INSENSITIVE and TYPE_SCROLL_SENSITIVE

2.2K 0 0
                                    

Types of resultsets

TYPE_FORWARD_ONLY

TYPE_SCROLL_INSENSITIVE  and

TYPE_SCROLL_SENSITIVE 

How can move the cursor in scrollable result sets?

Two arguments are generally passed for scrollable result sets

 The first argument indicates the type of ResultSet

TYPE
TYPE_FORWARD_ONLY
TYPE_SCROLL_INSENSITIVE
TYPE_SCROLL_SENSITIVE

creates a non scrollable ResultSet which can move in forward direction only
does not reflect changes made while it is still open
does reflect changes made while it is still open

The second argument is one of two ResultSet constants for specifying whether a result set is read-only or updatable

TYPE

CONCUR_READ_ONLY
CONCUR_UPDATABLE

ACTION

For read only operation

For update operation

Difference between TYPE_SCROLL_INSENSITIVE  and TYPE_SCROLL_SENSITIVE.

Difference between the two has to do with whether a result set reflects changes that are made to it while it is open and whether certain methods can be called to detect these changes

ResultSet of type TYPE_SCROLL_INSENSITIVE does not reflect changes made while it is still open

ResultSet of type TYPE_SCROLL_SENSITIVE does reflect changes made while it is still open

Make Updates to Updatable Result Sets.

In JDBC 2 rows can be  directly updated in resultset and the same will be reflected in database. To do the same we use updatable resultset which is done by passingResultSet.CONCUR_UPDATABLE to the createStatement()

Statement stmt =
 con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

See the following video on various feature in Apache CXF .      

http://www.youtube.com/watch?v=5YsAw0PpDio

Also visit our site from more such Java / J2EE/ Core Java interview question with answers videos.

You've reached the end of published parts.

? Last updated: Jul 23, 2013 ?

Add this story to your Library to get notified about new parts!

TYPE_SCROLL_INSENSITIVE  and TYPE_SCROLL_SENSITIVEWhere stories live. Discover now