The problem is here:
rs=preparedStatement.executeQuery(sql);
You shouldn't pass the SQL String
to executeQuery()
, since the prepared statement already contains the SQL String
with the ?
placeholder replaced by the value of movieName
.
Use:
rs=preparedStatement.executeQuery();