CacheRowset, JDBCRowset and WebRowset in Java.

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.
Example 1:
JdbcRowSet j = new JdbcRowSetImpl();
j.setCommand("SELECT * FROM TABLE_NAME);

Example 2:
ResultSet rs = stmt.executeQuery("SELECT * FROM AUTHORS");
CachedRowSet crset = new CachedRowSetImpl();

Example 3:
WebRowSet wrs = new WebRowSetImpl();
wrs.updateString(1, "stringXXX");
Different types of locks in JDBC
A lock is a preventive software mechanism that other users can not use the data resource...
How are Observer and Observable used in Java?
All the objects which are the instances of the sub class Observable, maintains a list of observers...
What is synchronization and why is it important in Java?
Synchronization is the process of allowing threads to execute one after another...
Post your comment