How to return a result set

How to create a forward-only read-only result set:

Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM PRODUCTS");

Hot to create a scrollable, updateable result set:

Statement statement = connection.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATEABLE);
ResultSet rs = statement.executeQuery("SELECT * FROM PRODUCTS");

Five ResultSet fields that set type and concurrency

Constant Description
TYPE_FORWARD_ONLY
TYPE_SCROLL_INSENSITIVE
TYPE_SCROLL_SENSITIVE
CONCUR_READ_ONLY
CONCUR_UPDATEABLE

More info can be found here: