Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc dbc:RohitDB1"); PreparedStatement stat=con.prepareStatement("select * from RegInfo where Login=? and Password=?"); stat.setString(1,Login); stat.setString(2,Password); rs=stat.executeQuery();
Not that this has anythingto do with servlets per-se, but yes that will happen. If you check the javadoc for the ResultSet class, you'll see that the next() method returns a boolean to indicate if the new current row is valid or not. You are just ignoring that, and going on to read data irrespective.