52. What is the difference between ResultSet and RowSet

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

Advertisements

9 Responses

  1. This information is a nice and a brief one. After reading this document one can get an idea about ResultSet and RowSet.
    But if there would be more syntactic representation it would be more easy for the reader to understand.

    Thanks and Regards,

    Amod Ranade

  2. I want to get an example for resultset and rowset can u plz send me an example f or it the def is helpfull
    thank u
    saradhi

  3. […] 52. What is the difference between ResultSet and RowSet […]

  4. Very usefull site. I want to know the alternative for CachedRowset, which is deprecated now. Please inform me.

    With Regards,

    I.Murugesan

  5. it is very use ful…

  6. santhosh its good

  7. […] What is the difference between ResultSet and RowSet […]

  8. Hy write somethings your own not copy paste in blog ok
    Don’t mind….

  9. very gud ans, every can get a clarity esaily.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: