File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes ResultSet vs RowSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "ResultSet vs RowSet" Watch "ResultSet vs RowSet" New topic

ResultSet vs RowSet

Dave Robbins
Ranch Hand

Joined: Sep 16, 2003
Posts: 131
Hello All,
first, a quick explaination of what I'm trying to do
I've got an applet that presents a view into a database
It accesses the database thru a servlet
applet makes http call to servlet passing it the query it wants to run
servlet runs query
return results to applet
so far I've succeeded in getting the servlet to extract the data from the ResultSet and package it as CSV strings or Vectors or some object and return it to the applet
I'd like to skip this step and just return the ResultSet back to the applet and let the applet proccess it
but the ResultSet isn't serializable so you can't do that
I googled around and found references to a CacheResultSet that is serializable but the references were a few years old and I can't find any more info, perhaps that idea got dropped??
now I'm investigating RowSet
the documentation sounds like it will do what I want
says it extends ResultSet and can be "disconnected" from database
ok, questions
both ResultSet and RowSet are interfaces not classes
when I create one in my code what is it, the driver I using's implementation of the interface??
this code works
ResultSet foo = stmt.executeQuery(str);
but I can't figure out how to get a RowSet
RowSet foo = (RowSet)stmt.executeQuery(str);
gives me a class cast exception
could it be that my driver doesn't implement RowSet?
I'm using mysql-connector 3.0.9
think I'll go peruse the driver docs
Thanks for any help
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33113

Take a look at Sun's tutorial on RowSet.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
German Tamayo

Joined: Dec 31, 2003
Posts: 1
to use the CachedRowSet:
CachedRowSet records = new CachedRowSet();
......../JDBC code here/.....
ResultSet foo = stmt.executeQuery(str);
return records
It must help you!
I agree. Here's the link:
subject: ResultSet vs RowSet
It's not a secret anymore!