A RowSet is an extension of a Java ResultSet. Like a result set, a rowset is a Java object that holds tabular data. A RowSet object is scrollable and updatable by default,
One of the main uses of a RowSet object is to make a ResultSet object scrollable and updatable when the DBMS driver does not otherwise have those capabilities. By populating a RowSet object with the contents of a ResultSet, you can effectively make the result set scrollable and updatable.
The following interfaces extend the RowSet interface:
Implementations of RowSet will normally be provided by third-party database vendors.
Default implementation are given by Sun:
A RowSet object is considered either connected or disconnected.
A RowSet object is a JavaBeans component, and it may operate without being connected to its data source.
For example, a RowSet implementation can be serializable and therefore sent across a network, which is particularly useful for small-footprint clients that want to operate on tabular data without incurring the overhead of a JDBC driver and data source connection.
Another feature of a RowSet implementation is that it can include a custom reader for accessing any data in tabular format, not just data in a relational database. Further, a RowSet object can update its rows while it is disconnected from its data source, and its implementation can include a custom writer that writes those updates back to the underlying data source.
RowSet objects use the JavaBeans event model, in which registered components are notified when certain events occur. For all RowSet objects, three events trigger notifications:
When you create a JdbcRowSet object with the default constructor, the new JdbcRowSet object will have the following properties:
CachedRowSetImpl crs = new CachedRowSetImpl();
crs.populate(resultSet);
jdbcRs.absolute(3);
jdbcRs.updateFloat("PRICE", 10.99f);
jdbcRs.updateRow();
jdbcRs.moveToInsertRow();
jdbcRs.updateString("COF_NAME", "HouseBlend");
jdbcRs.updateInt("SUP_ID", 49);
jdbcRs.updateFloat("PRICE", 7.99f);
jdbcRs.updateInt("SALES", 0);
jdbcRs.updateInt("TOTAL", 0);
jdbcRs.insertRow();
jdbcRs.last();
jdbcRs.deleteRow();
cachedRowSet.acceptChanges(connection);
where: