• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ResultSet vs RowSet

 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dave,
Take a look at Sun's tutorial on RowSet.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic