I'm using Oracle.
PreparedStatement pstmt = con.prepareStatement("SELECT * FROM BookLoanInfo WHERE title LIKE '%?%' ORDER BY bid");
ResultSet rs;
String bookstring = scan.nextLine();
try{
pstmt.clearParameters();
pstmt.setString(1, bookstring);
rs = pstmt.executeQuery();
The actual problem seems to be with either the setString
or how I have typed the query.
This however gives Invalid Column Index.
You'll need to specify the wildcards as part of your setString
statement.