click below
click below
Normal Size Small Size show me how
OCPJP709.5
Cert Obj Construct and Use RowSet Objects
[9.5.1] JdbcRowSet provides a JavaBean view of a ResultSet | RowSet an interface adds support to JDBC API for JavaBeansTM component model. |
[9.5.2] Multiple sub-interfaces of RowSet interface? | 5 more subinterfaces : JdbcRowSet, CachedRowSet, WebRowSet, JoinRowSet, FilteredRowSet + implementation classes. |
[9.5.3] How RowSet is used | A RowSet, which can be used as a JavaBeans component in a visual Bean development environment, can be created and configured at design time and executed at run time. |
[9.5.4] RowSet provides | 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. |
[9.5.5] RowSet setters | 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, |
[9.5.6] RowSet support for events | 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. |
[9.5.7] Unique how? The RowSet interface is unique in that it is intended to be implemented using the rest of the JDBC API. | RowSet implementation is a layer of software that executes "on top" of a JDBC driver. RowSet interface impl can be provided by anyone, including JDBC driver vendors who want to provide a RowSet implementation as part of their JDBC products. |
[9.5.8] A connected RowSet. | RowSet object may make a connection with a data source and maintain that connection throughout its life cycle |
[9.5.9] A RowSet may also make a connection with a data source, get data from it, and then close the connection. Such a RowSet is called a disconnected RowSet | A disconnected RowSet may make changes to its data while it is disconnected and then send the changes back to the original source of the data, but it must reestablish a connection to do so. |
[9.5.10] A disconnected RowSet may have a reader (a RowSetReader object) associated with it. | The reader may be implemented in many different ways to populate a RowSet with data, including getting data from a non-relational data source. |
[9.5.11] A disconnected RowSet may have a writer (a RowSetWriter object) associated with it. | The writer can also be implemented in many different ways to propagate changes made to the RowSet's data back to the underlying data source. |
[9.5.12] The RowSet interface extends the standard java.sql.ResultSet interface. The RowSetMetaData interface extends the java.sql.ResultSetMetaData interface. | Thus, developers familiar with the JDBC API will have to learn a minimal number of new APIs to use rowsets. In addition, third-party software tools that work with JDBC ResultSet objects will also easily be made to work with RowSet(s). |
[9.5.13] ResultSetMetaData rsmd = resultSet.getMetaData(); | rsmd.getColumnName(x) // x should be 1 or more! |
[9.5.14] Basic code structure for use RowSets | RowSetFactory rsf = RowSetProvider.newFactory); CachedRowSet studentRS = rsf.createCachedRowSet(); studentRS.setCommand("select SID, NAME from STUDENT2"); studentRS.execute(c); //at this point studentRS contains the data returned by the query. |
[9.5.15] absolute takes an int either positive or negative | positive from first and negative from last |