Connection cn = DriverManager.getConnection("jdbc:derby://localhost:1527/sample","root","root"); Statement st = cn.createStatement(); ResultSet rs = st.executeQuery("SELECT * FROM Quizz"); int count = 0, qno = 0; while (rs.next()) { qno++; if(rs.getString(7).equals(request.getParameter(" "+(++qno)))) { count++; out.println("

Correct

"); } else { out.println("

Incorrect

"); } out.println("

Your Score is " +count+ "

"); } } catch(SQLException e) { out.println(e); } out.println(""); out.println(""); }