I have very simple code:
pstat=con.prepareStatement(\"select typeid from users where username=? and password=?\");
pstat.setString(1, username);
You can only do this with a resultset that is of type TYPE_SCROLL_SENSITIVE, which is defined as "The constant indicating the type for a ResultSet object that is scrollable and generally sensitive to changes made by others."
You need to do something like the following ...
Statement statement =
connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);