Can not perform the plot. He says that he can not: Cat not resolve to parameter "1". Same with the second. The query itself works well. Here only preparedStatement does not see its parameters 1 and 2.

String query = "select ae.id, adr__get_search_name(ae.id) from address_element ae join address_element parent on parent.id = ae.parent_id where upper (parent.name) like ? and upper (ae.name ) like ?; try { PreparedStatement preparedStatement = connection.getConnection().prepareStatement(query); preparedStatement.setString(1, "'%" + regCityx + "%'"); preparedStatement.setString(2, "'%" + regStreetx + "%'"); 
  • Well, so Cat not resolve to parameter ... all the fault of Cat ) Well, seriously, then after LIKE should not go a word in the apostrophes? and generally try first on a static query, then add one parameter, etc. ... - ermak0ff
  • one
    Have you tried not to specify in the request ? and hands to drive and run? To check that it is correct. - Vartlok

1 answer 1

Remove the apostrophes in setString , the JDBC driver will do everything on its own.

  • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky
  • My statement is based on reading documentation, common sense, practical experience and a JUnit test. - Mikhail Kuchma