I get following error on Result set
java.sql.SQLException: ResultSet not open. Verify that autocommit is OFF.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.ResultSet.next(Unknown Source)
Qaiser Mehmood wrote:Reultset res is outside finaly block.
Not sure what you mean by that, but Jan is right. Your method returns a ResultSet that is closed, because you closed it in your finally block (by closing the connection).