title: Spring JDBC getting values returned from query
body: <p>Hi i have a query where i select values from the database and i would like to do a comparison with the selected data. I am able to create the query and pass in the parameters but i am still having some problems accessing the values returned from the query. Can someone tell me if i am on the right track, i think i wrote the last two statements incorrectly.</p>
  
  <pre><code>    String sql = "SELECT userName, password FROM tblusers WHERE userName = ? AND password = ? ";
  
  
  
      Object[] parameters = new Object[] {login.getUserName(), login.getPassword()};
  
      String dbUserName = (String)getJdbcTemplate().queryForObject(
              sql, parameters, String.class);
  
      String dbPassword = (String)getJdbcTemplate().queryForObject(
              sql, parameters, String.class);
  </code></pre>