• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serializing ResultSet  RSS feed

 
Ali Hassaan
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I m working in RMI.
One of my function is returning ResultSet,but s u know for ths ResultSet should b serializable.
So,how can i make ResultSet serializable.
 
Robert Brunner
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you could inherit from ResultSet and implement Serializable interfaces in a new class.
I would suggest a better approach would be to send XML between layers, or if you want an all Java solution, how about creating an object for each row, stuffing them in a collection class or vector, and serializing it instead of the ResultSet class.
 
Ali Hassaan
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Robert
I have done it through Vector(as u said).
 
A Agrawal
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have option of using jdbc3.0 you may also go for RowSet. which extends ResultSet.
The classes implementing RowSet (e.g. CachedRowSet) also implement Serializable. Here you get many advantages over using Vector for this purpose.

------------------
Amit Agrawal,
New Delhi, India.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!