*
The moose likes JDBC and the fly likes CachedRowSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "CachedRowSet" Watch "CachedRowSet" New topic
Author

CachedRowSet

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1371
I am using Oracle 9i DB. I would like to access some bulk data. So can i use JDBC's CachedRowSet for getting bulk data from the db, instead of hitting DB everytime.
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1371
Any reply???
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

Did you try google ?


Disadvantage

1. As all the table rows are taken into memory, care should be taken with the query which retrieves the number of rows, as it will be very resourceful if huge set of rows is taken and the application will get very slow.

2. As rowsets will keep a connection to itself , hence the connection object will be kept at the client which make the client heavy.As it can modify data at the client side inconsistancy may arise with the server containing actual data.


Advantages :

1. Certain implementations of rowset doesn't require the database connection to be maintained throughout the entire period of time it takes to process the data. So even if DB connection is lost in between it works all right. It makes a connection while finally inserting the processed (modified) data. Precisely it need to make the connection only twice once while reading and second while updating after processing is over.While in jdbc resultsets which need to hold the DB connection throughout its usage which might not be possible in many practical cases.

2.Since it reads a set of rows from the table and loads it into memory, processes it in the memory and finally inserts the modified data into the DB, it is obviously much faster than resultsets which refer to the db for each row read.

3.Since the rowset object contains the DB connection information all by itself, (No connection object or statement object ), Rowsets make it easy to send tabular data over a network, whereby if we sendf the Rowset object over the network it suffices and there isn't any need to provide the DB information separately.

4. RowSet object follows the JavaBeans model for properties and event notification, it is a JavaBeans component that can be combined with other components in an application.


Hope this answers your query

Shailesh
[ April 07, 2005: Message edited by: Shailesh Chandra ]

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Use TO/VO (Transfer Object/Value Object) instead.
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1371
How can i use To/VO?? any samples...
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

There are a lot of example on web.These are design patterns
see here detail of transfer object


Shailesh
[ April 08, 2005: Message edited by: Shailesh Chandra ]
 
Consider Paul's rocket mass heater.
 
subject: CachedRowSet
 
Similar Threads
consuquences of not closing ResultSet?
Accessing ResultSet after closing Statement/Connection gives an Exception
preferred collection class for storing Resultset?
Adv/disadv. of loading Bulk Data using Stateless Session Bean and JDBC
driverName or URL or ..., plz help