Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can i get a clone of Resultset

 
surendar prabu
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having resultsets obtained from execution of query on two different database connections. i want to work on the two result sets simultaneously.
My current condition is the first connection is closed before the execution of the second query. Is there any way where i can store the first resultset without having attachment to any connection?? or can i create a clone for the resultset.

clone method over the object class is having protected access and i am wondering how to proceed.

regards,
Surendar prabu
 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The resultset data is really just an array of HashMaps. Just build a set of HashMap out of the data and store it in memory.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by surendar prabu:
Is there any way where i can store the first resultset without having attachment to any connection?? or can i create a clone for the resultset.



I think CachedRowSet is the answer for you.

As per javadocs


A CachedRowSet object is a container for rows of data that caches its rows in memory, which makes it possible to operate without always being connected to its data source. Further, it is a JavaBeansTM component and is scrollable, updatable, and serializable. A CachedRowSet object typically contains rows from a result set, but it can also contain rows from any file with a tabular format, such as a spread sheet. The reference implementation supports getting data only from a ResultSet object, but developers can extend the SyncProvider implementations to provide access to other tabular data sources.


Thanks,
Shailesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic