The javax.sql package provides the rowset API, which makes it easy to handle data sets from virtually any data source as JavaBeans components. A RowSet object represents a set of rows returned by a database server as a result of running a SQL query or opening a table. According to JDBC API Tutorial and Reference, Third Edition (Addison-Wesley Professional, 2003), “a RowSet object is a container for tabular data, encapsulating a set of zero or more rows that have been retrieved from a data source. In a basic implementation of the RowSet interface, the rows are retrieved from a JDBC data source, but a ‘row set’ may be customized so that its data can also be from a spreadsheet, a flat file, or any other data source with a tabular format. A RowSet object extends the ResultSet interface, which means that it can be scrollable, can be updatable, and can do anything a ResultSet object can do.”
Different kinds of rowsets (these are all interfaces and extend the RowSet) are provided by J2SE 5.0 (I will provide details on these different rowsets in the following questions and answers):
Cached rowset:(javax.sql.CachedRowSet): A CachedRowSet object is special in that it can operate without being connected to its data source—that is, it is a disconnected RowSet object (disconnected rowsets are those that do not maintain a connection with their data sources).
JDBC rowset:(javax.sql.JdbcRowSet): A wrapper around a ResultSet object that makes it possible to use the result set as a JavaBeans component. Thus, a JdbcRowSet object can be one of the beans that a tool makes available for composing an application. A JdbcRowSet is a connected rowset.
Web rowset:(javax.sql.WebRowSet): A WebRowSet object is very special because in addition to offering all of the capabilities of a CachedRowSet object, it can write itself as an XML document and can also read that XML document to convert itself back to a WebRowSet object.
Filtered rowset:(javax.sql.FilteredRowSet): There are occasions when a RowSet object has a need to provide a degree of filtering to its contents. One possible solution is to provide a query language for all standard RowSet implementations; however, this is not a practical approach for lightweight components such as disconnected RowSet objects. The FilteredRowSet interface seeks to address this need without supplying a heavyweight query language along with the processing that such a query language would require.
Join rowset:(javax.sql.JoinRowSet): The JoinRowSet interface provides a mechanism for combining related data from different RowSet objects into one JoinRowSet object, which represents a SQL JOIN. In other words, a JoinRowSet object acts as a container for the data from RowSet objects that form a SQL JOIN relationship.
Synchronized Resolver rowset:(javax.sql.rowset.spi.SyncResolver): A SyncResolver object is a specialized RowSet object that implements the SyncResolver interface. It may operate as either a connected RowSet object(an implementation of the JdbcRowSet interface) or a connected RowSet object(an implementation of the CachedRowSet interface or one of its subinterfaces).
The following is taken from the J2SE 5.0 documentation:
The RowSet interface provides a set of JavaBeans properties that allow a RowSet instance to be configured to connect to a JDBC data source and read some data from the data source. A group of setter methods (setInt(), setBytes(), setString(), and so on) provide a way to pass input parameters to a rowset’s command property. This command is the SQL query the rowset uses when it gets its data from a relational database, which is generally the case. The RowSet interface supports JavaBeans events, allowing other components in an application to be notified when an event occurs on a rowset, such as a change in its value. The RowSet interface is unique in that it is intended to be implemented using the rest of the JDBC API. In other words, a RowSet implementation is a layer of software that executes “on top” of a JDBC driver. Implementations of the RowSet interface can be provided by anyone, including JDBC driver vendors who want to provide a RowSet implementation as part of their JDBC products.
And the following is taken from JDBC API Tutorial and Reference:
Rowsets may be either connected or disconnected.A connected RowSet object maintains a connection to its data source the entire time it is in use, whereas a disconnected rowset is connected to its data source only while it is reading data from the data source or writing data to it. While the rowset is disconnected, it does not need a JDBC driver or the full implementation of the JDBC API. This makes it very lean and therefore an ideal container for sending a set of data to a thin client. The client can, if it chooses, make updates to the data and send the rowset back to the application server. On the server, the disconnected RowSet object uses its reader to make a connection to the data source and write data back to it. Exactly how this is done depends on how the reader is implemented. Typically, the reader delegates making a connection and reading/writing data to the JDBC driver.
A rowset may be disconnected from a data source, that is, function without maintaining an open connection to a data source the whole time it is in use. In addition, a rowset can be serialized, which means that it can be sent to a remote object over a network (e.g., RMI Server).
According to the J2SE 5.0 documentation, the RowSet interface works with various other classes and interfaces behind the scenes. These can be grouped into three categories:
The RowSet interface may be implemented in any number of ways, and anyone may write an implementation. Developers are encouraged to use their imaginations in coming up with new ways to use rowsets.
JDBC Related Interview Questions
|Core Java Interview Questions||JSP Interview Questions|
|Java Servlets Interview Questions||EJB(Enterprise JavaBeans) Interview Questions|
|JSTL(JSP Standard Tag Library) Interview Questions||JNDI (Java Naming and Directory Interface) Interview Questions|
|Java Bean Utils Interview Questions||AWT (Abstract Window Toolkit) Interview Questions|
What Is Jdbc Programming?
Database Metadata, Part 1
Database Metadata, Part 2
Exploring Driver Property Information
Rowset Metadata A
Web Access To Metadata,part 1
Web Access To Metadata, Part 2
Rdf And Jdbc Metadata
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.