This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

preferred collection class for storing Resultset?

 
Bala Krishniah
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which is the preferred collection class to use for storing database ResultSets?
I have multiple columns in the result set, and I combine them into their own data structure for each row. Which is the best Collection class to store the objects??
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bala Krishniah:
Which is the preferred collection class to use for storing database ResultSets?
I have multiple columns in the result set, and I combine them into their own data structure for each row. Which is the best Collection class to store the objects??

I've always found ArrayLists to be sufficient ( better than Vectors ).
 
sarah Marsh
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why ArrayLists is better than Vectors ?
Thanks a lot.
 
Bosun Bello
Ranch Hand
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, ArrayList & Vector are pretty much the same besides the fact that the methods in the vector class are synchronized. If you don't need synchronization, then use an ArrayList.
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used CachedRowSet which is like resultset but remains alive after closing the connection. After that I sometimes make a bespoke bean for the data object and instantiate it in an array big enough (from .size() of the CachedRowSet)

Adam
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic