It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes Populating an ArrayList() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Populating an ArrayList()" Watch "Populating an ArrayList()" New topic

Populating an ArrayList()

Rick Harrison

Joined: Oct 16, 2000
Posts: 4
What is the best way to populate an ArrayList() from a sybase stored procedure result set? Thanks
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Create a class that has variables for each of the columns in your table. To be truly OO, you can make the variables private and add public get and set methods for each one. Instantiate one of these, add the columns to it, and add the object to your ArrayList. Instantiate a new one, add the columns, etc. until there are no more rows. Not recommended for ResultSets containing 25 million rows.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
I agree. Here's the link:
subject: Populating an ArrayList()
jQuery in Action, 3rd edition