Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using resultset to encapsulate data and pass by

 
Siamak Saarmann
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Xagyg Noodle
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Xagyg, thank you very much. Even though I have almost done the project, the paper should be very useful.

Mac
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic