A ResultSet maintains a connection to a database and because of that it can’t be serialized and also we cant pass the Resultset object from one class to other class across the network.
RowSet is a disconnected,
serializable version of a JDBC ResultSet and also the RowSet extends
the ResultSet interface so it
has all the methods of ResultSet. The RowSet can be serialized because
it doesn’t have a connection to any database and also it can be sent from
one class to another across the network.
More on RowSet:
- A RowSet can be connected or disconnected
- A disconnected rowset gets a connection to a data source in order to fill itself with data or to propagate changes in data back to the data source, but most of the time it does not have a connection open. While it is disconnected, it does not need a JDBC driver or the full JDBC API, so its footprint is very small. Thus a rowset is an ideal format for sending data over a network to a thin client.
- A connected RowSet is like a wrapper around the ResultSet.
Implementation:
A CachedRowSet class—a disconnected rowset that caches its data in memory; not suitable for very large data sets, but an ideal way to provide thin Java clients, such as a Personal Digital Assistant (PDA) or Network Computer (NC), with tabular data
A JDBCRowSet class—a connected rowset that serves mainly as a thin wrapper around a ResultSet object to make a JDBC driver look like a JavaBeans component
A WebRowSet class—a connected rowset that uses the HTTP protocol internally to talk to a Java servlet that provides data access; used to make it possible for thin web clients to retrieve and possibly update a set of rows
No comments:
Post a Comment