GeeCON Prague 2014*
The moose likes JDBC and the fly likes Using resultset to encapsulate data and pass by Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using resultset to encapsulate data and pass by" Watch "Using resultset to encapsulate data and pass by" New topic
Author

Using resultset to encapsulate data and pass by

Siamak Saarmann
Ranch Hand

Joined: Aug 21, 2004
Posts: 78
Hello,

I am working on an academic distributed database project. I will appreciate if someone can give me advice on this.

I receive a distributed query from user and gather the required data from nodes. Now I want to put it in a Resultset and pass it to the user (so that he can iterate over it etc.).

1- Is it possible in a simple way to use JDBC's Resultset object to encapsulate my data and pass it to the user in response to his distributed query or I should rather use my own custom structures?

2- Java's Resultset object needs a live connection even if I already have all the records available (limited set) ? In my current solution each query fetches all the needed rows (I assume limited number of rows) from different nodes and combines them in an array. Is it possible to use Resultset without involving an open Connection object to pass this information?

Thank you very much for your help.

Regards,
Mac
[ March 05, 2008: Message edited by: Siamak Saarmann ]

PhD Artificial Intelligence, OCJP1.6
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Distributed usually implies the need for serialization, and result sets are not Serializable. I'd use a Collection to encapsulate the results (that is the normal pattern).

You can use a CachedRowSet to get an ResultsSet you can operate on without a DB connection.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Xagyg Noodle
Greenhorn

Joined: Apr 10, 2008
Posts: 3
This may be interesting to you...

http://www.longbrothers.net/brad/

Main paper:

Distributed result set iterator: a design pattern for efficient retrieval of large result sets from remote data sources

and its supplement (at bottom of page):

Sorting non-key fields in the distributed result set iterator pattern
Siamak Saarmann
Ranch Hand

Joined: Aug 21, 2004
Posts: 78
Xagyg, thank you very much. Even though I have almost done the project, the paper should be very useful.

Mac
 
GeeCON Prague 2014
 
subject: Using resultset to encapsulate data and pass by