I have a table in MySQL wih title and description and I want to search for rows by word that is in some of these fields.
So , I added this to my table :
ALTER TABLE test_table ADD FULLTEXT(title,description);
and test with this query :
SELECT * FROM defects WHERE MATCH(title,description) AGAINST ('strawberry') ;
And it works :)
Now , I want to write this select with preparedStatement , but don't now how .
I tried with
PreparedStatement preparedStatement = connection.
prepareStatement("select * from defects where WHERE MATCH(title,description) AGAINST (?) ;");
preparedStatement.setString(1, searchedword);
ResultSet rs = preparedStatement.executeQuery();
but it's wrong. Sorry for stuped question but I really don't know how is right