aspose file tools*
The moose likes JDBC and the fly likes store recordset into array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "store recordset into array" Watch "store recordset into array" New topic
Author

store recordset into array

Yudi Ono
Greenhorn

Joined: Aug 24, 2008
Posts: 12
hi.

how to store recordset result into array?


thanks

regards

yudi




Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

When you say recordset, do you mean java.sql.ResultSet? If so, you need to iterate through the ResultsSet and for each row create an appropriate wrapper object (somehtign that encapsultes all the properties of the row), assign this object the values in the row then add it to the array.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Yudi Ono
Greenhorn

Joined: Aug 24, 2008
Posts: 12
thank you paul for the quick reply.

yes you are correct paul..java.sql.ResultSet is what i mean.

i have a result set like this.


could you please give me the example code?

thanks and regards


yudi
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

There is quite a detailed explanation in the JDBC tutorial (including examples). I suggest you have a read through that, you should find it useful.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38872
    
  23
Sounds like a thread which would sit better in the JDBC forum. Moving.
 
 
subject: store recordset into array