I am trying to compile a java file in the format:
PreparedStatement var = con.prepareStatement("SELECT * FROM table WHERE column LIKE '%?%';");
var.setString(1, string);
var.executeQuery();
However, it is not compiling, with the following errors. Can anyone explain why I am getting these errors?
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();