Resultset's getObject() method - how to use it properly?

ResultSet.getObject (and the other getXxx methods) will retrieve the data from the current row of the ResultSet and starts in index 1. You have set your i variable with 0 value.

Just change this

int i=0;

To

int i=1;

Also, getObject needs a single param, but you're incorrectly sending two:

Account account= rs.getObject(i, Account);

Probably you were trying to use ResultSet#getObject(int, Class) (available from Java 7), but you have to take into account that your Account class can't be magically converted from a database column to an instance of this object.

Looks like it would be better to review JDBC trial first, then retry to solve your problem.

Here's another good source to review: Using Customized Type Mappings