aspose file tools*
The moose likes JDBC and the fly likes preferred collection class for storing Resultset? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "preferred collection class for storing Resultset?" Watch "preferred collection class for storing Resultset?" New topic
Author

preferred collection class for storing Resultset?

Bala Krishniah
Ranch Hand

Joined: Dec 14, 2000
Posts: 81
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

Joined: Jul 09, 2001
Posts: 1879

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

Joined: Mar 06, 2001
Posts: 282
Why ArrayLists is better than Vectors ?
Thanks a lot.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
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.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
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


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
 
 
subject: preferred collection class for storing Resultset?