when I get a ResultSet output, it is always "plugged" to db, so every time I use "resultset.next()" it actually do requests to db. I always thought that when I perform something like this:
public static ResultSet getInfoFromDB(){
ResultSet resultSet;
try{
Connection connection = connectDB();
Statement statement = connection.createStatement();
resultSet = statement.executeQuery("SELECT * from tablex");
} catch (Exception e) {
throw new RuntimeException(e);
}
return resultSet;
}
I thought that since I am selecting * from table, that it was return ALL the table into the variable resultSet.... but it acutally isn't.
How to retrieve all the table and save into a "local" (non "plugged" to db) variable that I can return and manipulate it in local?