title: JDBC Error for prepared Statement giving SQL exception. Why?
body: <p>I am trying to compile a java file in the format:</p>
  
  <pre><code>PreparedStatement var = con.prepareStatement("SELECT * FROM table WHERE column LIKE '%?%';");
  
  var.setString(1, string);
  var.executeQuery();
  </code></pre>
  
  <p>However, it is not compiling, with the following errors. Can anyone explain why I am getting these errors?</p>
  
  <pre><code>BookPurchase.java:97: error: unreported exception SQLException; must be caught or declared to be thrown
              con.prepareStatement(
                                  ^
  BookPurchase.java:100: error: unreported exception SQLException; must be caught or declared to be thrown
              searchResults.setString(1, keyword);
                                     ^
  BookPurchase.java:101: error: unreported exception SQLException; must be caught or declared to be thrown
              searchResults.executeQuery();
  </code></pre>