Explain CacheRowset, JDBCRowset and WebRowset.
A CacheRowSet object is a container for rows, that ‘caches’ the rows in the memory. The operations on the rows can be done without being connected to its data source. It is one of the Java bean components and is scrollable, updatable and serializable. An object of CacheRow set contains results from a result set and data in the tabular form such as a spread sheet. Modifications in the data, if any, in a CacheRowSet is permitted. The updated data then can be propagated back to the source of the data.
A JDBCRowSet is a connected row set. I maintain the connection to a database with the help of JDBC drivers. It effectively makes the driver as a Java Bean component. One more advantage of JDBCRowSet is that, it can make a ResultSet object both scrollable and updatable. If a driver and a database do not support scrolling and updating of result set, then an application can populate JDBCRowSet object along with data of a ResultSet object.
To describe a RowSet object in XML format, the WebRowSet object is implemented. The schema of WebRowSet objects utilizes the specific SQL/XML schema annotations, which ensures greater platform inter-operability.
JdbcRowSet is a connected type of rowset as it maintains a connection to the data source using a JDBC driver
CachedRowSet and WebRowSet are disconnected types of rowsets as they are connected to the data source only when reading data from it or writing data to it.
JdbcRowSet j = new JdbcRowSetImpl();
j.setCommand("SELECT * FROM TABLE_NAME);
ResultSet rs = stmt.executeQuery("SELECT * FROM AUTHORS");
CachedRowSet crset = new CachedRowSetImpl();
WebRowSet wrs = new WebRowSetImpl();