All RowSet objects are JavaBeans components. A property is a field that has corresponding getter and setter methods. Properties are exposed to builder tools such as those that come with the IDEs JDveloper and Eclipse that enable you to visually manipulate beans. For more information, see the Properties lesson in the JavaBeans trail.
|Published (Last):||26 February 2010|
|PDF File Size:||2.78 Mb|
|ePub File Size:||4.25 Mb|
|Price:||Free* [*Free Regsitration Required]|
If you use the default constructor, you must set some additional properties before you can populate your new JdbcRowSet object with data. In order to get its data, a JdbcRowSet object first needs to connect to a database. The following four properties hold information used in obtaining a connection to a database.
The preferred way is to use a DataSource object, but it may not be practical for you to register a DataSource object with a JNDI naming service, which is generally done by a system administrator. Therefore, the code examples all use the DriverManager mechanism to obtain a connection, for which you use the url property and not the datasourceName property.
Another property that you must set is the command property. This property is the query that determines what data the JdbcRowSet object will hold. It executes the query you set in the command property. It reads the data from the resulting ResultSet object into the jdbcRs object. The Coffee Break chain of coffee houses acquired another chain of coffee houses and now has a legacy database that does not support scrolling or updating of a result set.
In other words, any ResultSet object produced by this legacy database does not have a scrollable cursor, and the data in it cannot be modified. However, by creating a JdbcRowSet object populated with the data from a ResultSet object, you can, in effect, make the ResultSet object scrollable and updatable.
As mentioned previously, a JdbcRowSet object is by default scrollable and updatable. Because its contents are identical to those in a ResultSet object, operating on the JdbcRowSet object is equivalent to operating on the ResultSet object itself.
And because a JdbcRowSet object has an ongoing connection to the database, changes it makes to its own data are also made to the data in the database. This section covers the following topics:.
Using JdbcRowSet Objects
Introduction to the JDBC RowSet Interface in Java
JDBC RowSet Example
Using RowSet Objects