I have a struggle to get the IN parameter to work inside the LIKE statement for hours! I use CachedRowSet, which, as I understand it, must follow the same rules as PreparedStatement.
Here is the main request:
CachedRowSet cache;
String sql = "SELECT x " +
"FROM Y " +
"WHERE z LIKE '?__'"
cache.setCommand(sql);
cache.setString(1, "someString");
someString is a well-known identifier, but the database (by the way, PostgreSQL) has an unknown 2 char suffix.
source
share