title: Java does not run prepare statements with parameter
body: <p>I am using PreparedStatement to query my table. Unfortunately, I have not been able to do so.</p>
  
  <p>My code is as simple as this:</p>
  
  <pre><code>PreparedStatement preparedStatement = connection.prepareStatement(
  "Select favoritefood from favoritefoods where catname = ?");
  
  preparedStatement.setString(1, "Cappuccino");                
  ResultSet resultSet = preparedStatement.executeQuery();
  </code></pre>
  
  <p>The error thrown is <code>java.sql.SQLException: ORA-00911: invalid character</code>. As if it never run through the parameter given.</p>
  
  <p>Thanks for your time. I've spend a day to debug this yet still unsuccessful.</p>
  
  <p>As mention by Piyush, if I omit the semicolon at the end of statement, a new error is thrown. <code>java.sql.SQLException: ORA-00942: table or view does not exist</code>. But I can assure you this table is indeed exist.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>shoot. i edited the wrong sql. now it is successful. thx for your time.</p>