title: unable to validate username and password from DB in jsp login form
body: <p>After registration, user will see this form where all the details from registration form are captured into database</p>
  
  <pre><code>&lt;html&gt;
          &lt;head&gt;
              &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
              &lt;title&gt;JSP Page&lt;/title&gt;
          &lt;/head&gt;
          &lt;body&gt;
              &lt;h3&gt;Email confirmation has been sent to your email address&lt;/h3&gt;
              &lt;a href="http://localhost:6060/JSP_RegistrationAndLoginForm/LoginForm.jsp"&gt;click here to login&lt;/a&gt;
          &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Login Form:</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;body&gt;
          &lt;h3&gt;Login Form&lt;/h3&gt;
          &lt;form name="myForm" method="POST" action="ValidateLoginServlet2.do" onSubmit="return validateLogin()"&gt;
              User name: &lt;input type="text" name="uname"/&gt; 
              Password: &lt;input type="password" name="pwd"/&gt;
              &lt;input type="Submit" name="submit" value="Submit" /&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Login validation servlet:</p>
  
  <pre><code>public class ValidateLoginServlet2 extends HttpServlet {
  
      @Override
      protected void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
  //        processRequest(request, response);
          PrintWriter out = response.getWriter();
  
          String username = request.getParameter("uname");
          String password = request.getParameter("pwd");
  
          try
          {
              Connection con = OracleDBConnection.getConnection();
              PreparedStatement statement = con.prepareStatement("select username, password from registration where username =? and password=?");
              statement.setString(1, username);
              statement.setString(2, password);
              ResultSet result = statement.executeQuery();
              if(result.next())
              {
                  response.sendRedirect("LoginSuccessful.jsp");
              }
              else
              {
                  out.println("username and password are incorrect");
              }
          }
          catch(Exception e)
          {
              e.printStackTrace();
          }   
      }
  </code></pre>
  
  <p>I get an DB related error after submitting username and password from the login form saying <code>java.sql.SQLException: ORA-00904: "PASSWORD": invalid identifier</code></p>