Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet --> ArrayList or Vector

 
Naveen Asha
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How we can convert a resultset in a collection framework e.g. ArrayList or Vector?
Thank you,
Naveen
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am moving your post to the JDBC forum since it doesn't deal with any GUI issues...
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
 
Matthew Payne
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic