aspose file tools*
The moose likes JDBC 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
Bookmark "ResultSet vs RowSet" Watch "ResultSet vs RowSet" New topic
Author

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
this
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
Dave
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30512
    
150

Dave,
Take a look at Sun's tutorial on RowSet.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
German Tamayo
Greenhorn

Joined: Dec 31, 2003
Posts: 1
Hi,
to use the CachedRowSet:
CachedRowSet records = new CachedRowSet();
......../JDBC code here/.....
ResultSet foo = stmt.executeQuery(str);
records.populate(foo);
return records
It must help you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet vs RowSet