• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet vs RowSet

 
Dave Robbins
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34669
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave,
Take a look at Sun's tutorial on RowSet.
 
German Tamayo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic