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 ResultSet --> ArrayList or Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ResultSet --> ArrayList or Vector" Watch "ResultSet --> ArrayList or Vector" New topic
Author

ResultSet --> ArrayList or Vector

Naveen Asha
Greenhorn

Joined: Mar 30, 2003
Posts: 12
How we can convert a resultset in a collection framework e.g. ArrayList or Vector?
Thank you,
Naveen
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I am moving your post to the JDBC forum since it doesn't deal with any GUI issues...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

ArrayList is the Collection of choice. If you need to synchronize the list, use the Collections utilities instead of using a Vector. Vectors are outdated and shouldn't really be used when writing new code.
Jamie
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Take a look at a recent Intermediate Forum thread on this topic.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Matthew Payne
Greenhorn

Joined: May 12, 2003
Posts: 4
RowSetDynaClass could help
import org.apache.commons.beanutils.RowSetDynaClass;
then --->
rs = pstmt.executeQuery();
RowSetDynaClass rsdc = new RowSetDynaClass(rs);
rows = rsdc.getRows();
List rows = rsdc.getRows();
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet --> ArrayList or Vector