I am using a PreparedStatement to execute queries from within my Java code:
String query = "select title from video where substring_index(path,'\\',-1) = ?;"
PreparedStatement ps = con.prepareStatement(query);
ps.setString(1,value);
The call of setString(1,value) causes:
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
When executed in the terminal, the query works fine. If I don't use the substring_index() function, it also works:
String query = "select title from video where path = ?;"
It seems that the ? does not get recognized as a parameter when I use it in combination with substring_index().
I am running MySQL 8.0.17 in combination and mysql-connector-java-8.0.13.jar.
Any ideas what the issue could be?