File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Can I clone ResultSet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can I clone ResultSet?" Watch "Can I clone ResultSet?" New topic
Author

Can I clone ResultSet?

xiaorui chen
Greenhorn

Joined: Sep 05, 2000
Posts: 9
ResultSet is interface, and hold the result after I query the database.
Can I open another space to hold that result set using cloning?
How can I do that?
Thanks!
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Strinctly a class which implements ResultSet doesn't hold any data. Drivers are free to go back to the database for each "next()". This is why a ResultSet is usually neither serializable nor cloneable.
What almost everyone does is read the results into some other data structure (a 2d array, a Vector of arrays, an ArrayList of Maps, whatever.) You can make that data structure serializable or cloneable if you wish.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Can I clone ResultSet?