top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is JDBC RowSet? What are different types of RowSet?

0 votes
768 views
What is JDBC RowSet? What are different types of RowSet?
posted Aug 23, 2017 by Sourav Kumar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

JDBC RowSet holds tabular data in more flexible ways that ResultSet. All RowSet objects are derived from ResultSet, so they have all the capabilities of ResultSet with some additional features. RowSet interface is defined in javax.sql package.

Some additional features provided by RowSet are:

Functions as Java Beans with properties and their getter-setter methods. RowSet uses JavaBeans event model and they can send notifications to any registered component for events such as cursor movement, update/insert/delete of a row and change to RowSet contents.
RowSet objects are scrollable and updatable by default, so if DBMS doesn’t support scrollable or updatable ResultSet, we can use RowSet to get these features.

RowSet are broadly divided into two types:

Connected RowSet Objects – These objects are connected to database and are most similar to ResultSet object. JDBC API provides only one connected RowSet object javax.sql.rowset.JdbcRowSet and it’s standard implementation class is com.sun.rowset.JdbcRowSetImpl
Disconnected RowSet Objects – These RowSet objects are not required to connected to a database, so they are more lightweight and serializable. They are suitable for sending data over a network. There are four types of disconnected RowSet implementations.
CachedRowSet – They can get the connection and execute a query and read the ResultSet data to populate the RowSet data. We can manipulate and update data while it is disconnected and reconnect to database and write the changes.
WebRowSet derived from CachedRowSet – They can read and write XML document.
JoinRowSet derived from WebRowSet – They can form SQL JOIN without having to connect to a data source.
FilteredRowSet derived from WebRowSet – We can apply filtering criteria so that only selected data is visible.

answer Aug 24, 2017 by Ayush Srivastav
...