0

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.

Aldwoni
  • 1,168
  • 10
  • 24

1 Answers1

0

You'll need to specify the wildcards as part of your setString statement.

Wildcard in Prepared Statement

Community
  • 1
  • 1
Nick
  • 2,524
  • 17
  • 25