right syntax to use near '?'
You should execute the PrepareStatement
with no parameters as follows:
statement.executeQuery()
Calling executeQuery
with a String
parameter will execute the provided query as is (without the bound parameters).
ResultSet resultPerson = statement.executeQuery(searchPerson);
should be
ResultSet resultPerson = statement.executeQuery();