I have very simple code:
pstat=con.prepareStatement(\"select typeid from users where username=? and password=?\");
pstat.setString(1, username);
java.sql.SQLException: Result set type is TYPE_FORWARD_ONLY
with JDBC 2.0 API, the user has the flexibility to move the cursor either forward or backward.
Your error can be removed by creating the statemnt as follows
Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
Also, a better way to count the number of rows would be
rs=pstat.executeQuery(); //execute the query
rs.last(); //move the cursor to the last row
int numberOfRows = rs.getRow(); //get the number of rows
rs.beforeFirst(); //back to initial state