This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes CachedRowSetImpl vs RowSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "CachedRowSetImpl vs RowSet" Watch "CachedRowSetImpl vs RowSet" New topic
Author

CachedRowSetImpl vs RowSet

Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 302
I have been using CachedRowSetImpl because I remember reading that I cannot use RowSet after I close the connection. Now I am not sure. If my assumption correct. Could I use RowSet after clossing the connection if I create the Statement with RowSet.CONCUR_READ_ONLY?


Your help will be greatly appreciated,
Alejandro Barrero
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

Alejandro Barrero wrote: Could I use RowSet after clossing the connection if I create the Statement with RowSet.CONCUR_READ_ONLY?



Yes you can use rowset after closing connection, I tried it long back, check if this helps

http://ilovej2ee.blogspot.com/2008/01/using-cachedrowset-in-java.html


Thanks,
Shailesh


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 302
Thank you Shailesh.
Alan Moor
Greenhorn

Joined: Apr 07, 2010
Posts: 3
Um, yeah. If your RowSet was created from Statement tied to a Connection and you close the Connection, all the resources opened by that connection SHOULD be released. If you have a scrollable rowset, it is possible that the JDBC driver (incorrectly) has rows cached that you can use, but if you haven't retrieved all the rows, you won't be able to scroll past the last block retrieved.

If your intent is to disconnect the Rowset from the database connection, then you should use the disconneced rowset (CachedRowSetImpl).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CachedRowSetImpl vs RowSet
 
Similar Threads
Problem returning serialized CachedRowSetImpl in servlet
pagination - Where
Performace of accessing db recs
CachedRowSet.acceptChanges();
using datasource help