The following must be considered when using the ResultSet interface:
Before reading any values, you must call next(). This returns true if there is a result, but more importantly, it prepares the row for processing.
Under the JDBC specification, you should access a field only once. It is safest to stick to this rule, although at the current time, the PostgreSQL™ driver will allow you to access a field as many times as you want.
You must close a ResultSet by calling close() once you have finished using it.
Once you make another query with the Statement used to create a ResultSet, the currently open ResultSet instance is closed automatically.