ResultSet is a beginner of JDBC programming and a commonly used operation database class, starting with JDK 1.4, easy to use the rowset interface to be introduced. The RowSet interface extends the standard Java.sql.ResultSet interface. The Rowsetmetadata interface extends the Java.sql.ResultSetMetaData interface. Therefore, developers who are familiar with the JDBC API must learn a few new APIs to use rowset. In addition, Third-party software tools that are used in support of JDBC ResultSet objects can also be easily used for rowset. However, in JDK 1.4, there is only one rowset interface, which makes the scope of rowset use a discount. However, JDK 5.0 defines 5 standard JDBC RowSet interfaces, and gives the corresponding reference implementations, making it easy to use the functionality provided by the RowSet interface.
The RowSet object can establish a connection to the data source and maintain the connection throughout its lifecycle, in which case the object is referred to as the RowSet of the connection. Rowset can also create a connection to a data source, get data from it, and then close it. This rowset is known as a connectionless rowset. Non-connected rowset can change their data when disconnected, and then send those changes back to the original data source, although it must re-establish the connection to complete this operation. Compared with Java.sql.ResultSet, RowSet off-line operation can effectively use the computer more and more sufficient memory, reduce the burden of the database server, because the data operations are in memory and then batch submitted to the data source, flexibility and performance has been greatly improved. RowSet default is a scrollable, updatable, serializable result set that, as a JavaBeans, can be easily transferred between networks for data synchronization at both ends.
1. Comparison with ResultSet
(1) rowset extends the ResultSet interface, so you can use rowset as you would with resultset.
(2) Rowset expands the ResultSet interface, so the function is more and richer than resultset.
(3) By default, all RowSet objects are scrollable and updatable. The resultset can only be scrolled forward and read-only.
(4) Rowset can be unlinked, while ResultSet is connected. Therefore, the data can be manipulated off-line using the Cacherowset interface.
(5) The rowset interface adds JDBC API support for the JavaBeans component model. Rowset can be used as a JavaBeans component in a visual Bean development environment.
(6) rowset adopted a new method of connecting the database.
(7) Cacherowset can be serialized.
(8) Rowset and resultset all represent a row of data, attributes, and related methods of operation.
(9) Think that you should tend to regard rowset as something unrelated to the database, which is just an object representing a row of data, while ResultSet is a closely related thing to the database.