rowset img - Learn JdbcRowSet, CachedRowSet and WebRowSet using Oracle

Learn JdbcRowSet, CachedRowSet and WebRowSet using Oracle

Posted on

rowset img - Learn JdbcRowSet, CachedRowSet and WebRowSet using OracleSimply as DataSource objects present an alternative choice to DriverManager, RowSet objects present an alternative choice to ResultSet objects. The RowSet interface extends the ResultSet interface, giving you a similar performance for viewing and manipulating information plus further performance that makes it a versatile and highly effective object to make use of in your purposes.

A RowSet object allows you to use information retrieved from a knowledge supply in many alternative methods. For instance, utilizing rowsets, you possibly can carry out the next duties:

  • Move populated RowSet objects over networks to skinny shoppers like PDAs
  • View and replace information in disconnected environments
  • Mimic scrollable and updateable consequence units for drivers that don’t assist these options
  • Generate self-contained XML paperwork representing RowSet objects

RowSet Modes:

Rowsets function in two modes: linked and disconnected.

1) Related RowSet: A linked rowset, like a consequence set, requires a steady connection to the database. An error happens when you use both a ResultSet or RowSet object after explicitly closing the connection or it in any other case breaks unexpectedly. As well as, a linked rowset all the time requires the presence of a JDBC driver so it might probably talk with the database.

2) Disconnected RowSet: A disconnected rowset, against this, shops row and column information in reminiscence. Consequently, the item doesn’t depend on a knowledge supply connection to view and manipulate the info; it simply accesses it from reminiscence. Nevertheless, you do want a connection to initially populate a disconnected RowSet object. As soon as populated, the item disconnects from the info supply routinely.

RowSet Varieties:

1) JdbcRowSet: The JdbcRowSet class supplies a fundamental implementation of the javax.sql.RowSet interface, which turns a ResultSet object right into a JavaBean and abstracts the main points of working with ResultSet objects. You should use this object to simplify connection steps or to supply scrollable and updateable cursors for drivers that don’t assist these options. Nevertheless, JdbcRowSet objects can solely function in linked mode, thus requiring the presence of a JDBC driver.

2) Cached RowSet: The CachedRowSet class supplies the identical performance because the JdbcRowSet class, with one vital distinction: a CachedRowSet object can function in a disconnected surroundings. Consequently, it might probably perform with no JDBC driver current. When you populate a CachedRowSet object with information chances are you’ll ship it over the community to skinny shoppers, present it to gross sales professionals on their laptops, or serialize it for information archiving. The benefit of the CachedRowSet object is that the shopper to whom you ship the item doesn’t want the JDBC driver.

3) Net RowSet:The WebRowSet class extends the CachedRowSet class, which helps you to use the identical properties and strategies in addition to function in disconnected mode. Nevertheless, the WebRowSet object can generate XML paperwork representing itself. You should use these paperwork to create copies of the WebRowSet object, which makes it straightforward so that you can distribute the knowledge throughout the Net and thru firewalls utilizing HTTP. It can seemingly play a significant function because the Net-services structure continues to develop.

RowSet Comparision:

JdbcRowSet compare - Learn JdbcRowSet, CachedRowSet and WebRowSet using Oracle

Following code display find out how to implement JdbcRowSet utilizing Oracle

CacheRowSet implementation utilizing Oracle…

and Lastly WebRowSet…

Supply techzoo.org