Hi
Im attempting to return a ArrayList from a jdbc resultset. This is the code I have so far.
public ArrayList doRead()
{
ArrayList results = new ArrayList();
String query = "select * from test";
try{
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next() ) {
}
} catch (SQLException e)
{
//something went wrong with the sql
}
finally
{
return results;
}
}
Im having troulbe figuring out how do I insert each row of the result set into the array. So that the array can later be used by a jsp to output the results? I'd be grateful for any pointers in the right direction.
Thanks
Eamo