Different types of resultset in JDBC

What are different types of ResultSet in JDBC?

ResultSet contains results of the SQL query. There are 3 basic types of ResultSet.

Forward-only
As name suggest, this type can only move forward and are non-scrollable.

Scroll-insensitive
This type is scrollable which means the cursor can move in any direction. It is insensitive which means any change to the database will not show change in the ResultSet while it open.

Scroll-sensitive
This type allows cursor to move in any direction and also propagates the changes done to the database.

Explain the different types of ResultSet in JDBC.

The result of a SQL query is available in ResultSet object. ResultSets are of 3 types.

Forward-only
This type of ResultSet can make the traversal for rows only in the forward direction and non-scrollable.

Scroll-insensitive
Scroll-insensitive ResultSet are not capable for scrolling. That means the cursor can move in only one direction. When the ResultSet is open, any change to the database table will not reflect.

Scroll-sensitive
Unlike Scroll-insensitive, the Scroll-sensitive ResultSet is capable to move the cursor in bidirectional. It also enables the changes done to the database tables when open.
Different transaction Isolation levels in JDBC
JDBC Isolation levels - Transaction Isolation levels is used to implement locking. They decide how one process isolated from other is. We have four ...
Explain optimistic and pessimistic locking in JDBC
JDBC Optimistic and Pessimistic locking - There are two kinds of locking available in JDBC.Optimistic Locking, Pessimistic Locking...
What causes the "No suitable driver" error?
JDBC - No suitable driver - Failure to load the appropriate JDBC driver before giving a call to DriverManager.getConnection method causes ‘No Suitable Driver’ error...
Post your comment
Discussion Board
Code 2 Learn : Learn, Code, Share
You can post tutorials from blog to help your viewers be successfull in technical interviews as i write about Tutorials on CS topics ie Programming Lang, HTML, Algos etc.

If interested then do reply.
Farhan Khwaja 04-13-2012