title: How to use not equal operator in java database query?
body: <p>I am making a query in my managed bean. here is the code:</p>
  
  <pre><code> try {
          PreparedStatement checkDB = (PreparedStatement) con.prepareStatement("SELECT * FROM boats where age= ? and color &lt;&gt; ?");
          checkDB.setString(1, (String) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("age"));
          checkDB.setString(1, (String) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("color"));
          ResultSet res=(ResultSet) checkDB.executeQuery();
          return res;
      } catch (Exception e) {
          return null;
      }
  </code></pre>
  
  <p>I am sure that this query works without the condition "color &lt;> ?". But when i add this does not work. I think there is a problem about my not equal operator. I searched how it is used and saw the same usage as i did. I also tried "!=" but did not work either. I am using MySQL database. Can anyone help?</p>
  
  <p>Thanks</p>