Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where jdbc Rowsets are used?

Tags:

java

sql

jdbc

There are some JDBC Rowsets like CachedRowSet, WebRowSet, FilteredRowSet and JoinRowSet. Does any bode know where they are used? Ok, may be CachedRowSet is good where I do not want open and connection, may be WebRowSet good when I need insert some XML data ("may be" but I do not sure). But what about others?

Obviously, It is better for performance to write join in SQL query instead of create 2 JoinRowSet, take all data from they and join fields in java. The same about FilteredRowSet - it is more efficient to add where clause to the SQL query instead of grub a lot of the data and filtered it by java.

But somebody "invented" CachedRowSet, WebRowSet, FilteredRowSet and JoinRowSet why? Does anybody has some good experience about they usage?

like image 756
Cherry Avatar asked Nov 23 '12 10:11

Cherry


People also ask

What is the use of Cachedrowsetimpl?

A CachedRowSet object is a container for rows of data that caches its rows in memory, which makes it possible to operate without always being connected to its data source. Further, it is a JavaBeansTM component and is scrollable, updatable, and serializable.

Which of these is an example of connected RowSet?

Only one of the standard RowSet implementations is a connected RowSet object: JdbcRowSet .

What is the difference between ResultSet and RowSet?

A Row Set can be connected, disconnected from the database. A ResultSet always maintains the connection with the database. A Row Set object can be serialized. It cannot be serialized.


1 Answers

The CachedRowSet interface defines the basic capabilities available to all disconnected RowSet objects. The other three are extensions of the CachedRowSet interface, which provide more specialized capabilities. The following information shows how they are related:

A CachedRowSet object has all the capabilities of a JdbcRowSet object plus it can also do the following:

  • Obtain a connection to a data source and execute a query.
  • Read the data from the resulting ResultSet object and populate itself with
    that data.
  • Manipulate data and make changes to data while it is
    disconnected.
  • Reconnect to the data source to write changes back to it.
  • Check for conflicts with the data source and resolve those
    conflicts

A WebRowSet object has all the capabilities of a CachedRowSet object plus it can also do the following:

  • Write itself as an XML document
  • Read an XML document that describes a WebRowSet object

A JoinRowSet object has all the capabilities of a WebRowSet object (and therefore also those of a CachedRowSet object) plus it can also do the following:

  • Form the equivalent of a SQL JOIN without having to connect to a data source

A FilteredRowSet object likewise has all the capabilities of a WebRowSet object (and therefore also a CachedRowSet object) plus it can also do the following:

  • Apply filtering criteria so that only selected data is visible. This is equivalent to executing a query on a RowSet object without having to use a query language or connect to a data source.
like image 110
Ajay Kumar Avatar answered Oct 03 '22 14:10

Ajay Kumar