In MYSQL database I have a table name search. When I write this query it executed successfully.
"select * from 'search' where path like %overview%"
But when I write it in java:
String query="SELECT path FROM `search` WHERE path like %?% ";
java.sql.PreparedStatement st=con.prepareStatement(query);
st.setString(1,textField.getText() );
ResultSet rs=st.executeQuery();
It's not working and displays an error:
com.mysql.jdbc.exception.jdbc4.MySQLSystaxErrorException: you have an error in sql syntax; check the manual that corresponds to your Mysql server version for the right Syntax to use near '%'overview'%' at line 1