title: Syntax error in WHERE clause near '?) AND (Date = ?)'
body: <p>I am trying to send a SQL prepared statement to MySQL DB. This is what I have:</p>
  
  <pre><code>    String sql1 = "SELECT idReimbursed_Funds As idReimFunds FROM reimbursedfunds Where ReimFundsName = ? AND Date = ?";
      PreparedStatement pstmt1 = conn.prepareStatement(sql1);
      pstmt1.setString(1, reimfund.getReimFundsName());
      pstmt1.setDate(2, (Date) reimfund.getDate());
      ResultSet rs1 = pstmt1.executeQuery(sql1);
      while(rs1.next()){                            
           idReimFunds = rs1.getInt("idReimFunds");                                                   
       }
  </code></pre>
  
  <p>After googling this problem, I found solutions to use parenthesis around the question marks or the whole where clause such as:</p>
  
  <pre><code>    String sql1 = "SELECT idReimbursed_Funds As idReimFunds FROM reimbursedfunds Where (ReimFundsName = ?) AND (Date = ?)";
  </code></pre>
  
  <p>This didn't work though. I get the same error message that is generated by my original code:</p>
  
  <p>"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?) AND (Date = ?)' at line 1.</p>
  
  <p>When I try the SQL statement in MySQL Workbench is works fine. Is there a way to use 2 where clauses with JDBC? I know in other posts people have answered that it has to be sent as two different queries, but I thought I would ask just in case someone else reads this posts and knows of a way. Thank you!</p>