title: Error at ps.executeQuery(sql) while using sql with timestamps
body: <p>I am getting dates from JSP and casting them into timestamp</p>
  
  <pre><code>DBConnection    = ConnMgr.getConnection();       
  Timestamp timestamp1 = new java.sql.Timestamp(date1.getTime());
  Timestamp timestamp2 = new java.sql.Timestamp(date2.getTime());
  </code></pre>
  
  <p>I have a sql statement and prepared staement as follows</p>
  
  <pre><code>String sql      = " select * from images where uploadedOn&gt;=? and uploadedOn&lt;=?;";
  ps              = DBConnection.prepareStatement(sql);
  ps.setTimestamp(1, timestamp1);
  ps.setTimestamp(2, timestamp2);
  System.out.println(ps);
  </code></pre>
  
  <p>This print statement is printing this is in console </p>
  
  <pre><code>select * from images where uploadedOn&gt;='2015-02-02 00:00:00' and uploadedOn&lt;='2015-02-05 00:00:00';
  </code></pre>
  
  <p>which is working fine when copied into the mySQL workbenck and run. But it is giving error in the following statement</p>
  
  <pre><code>rs              = ps.executeQuery(sql);
  </code></pre>
  
  <p>The error is</p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 uploadedOn&lt;=?' at line 1
  </code></pre>
  
  <p>Struggling with this since yesterday. Can any one help me to solve this out?</p>