I'm using the Statement's for executeUpdate and executeQuery. The string values I'm concatenating into the SQL query can contain at least the '\ character as well as Unicode.
PreparedStatement seems to do this automatically, but is there some utility function in the JDBC library to escape an arbitrary string for use in a SQL query?
Example errors I've ran into:
org.postgresql.util.PSQLException: ERROR: unterminated quoted string at or near
and
org.postgresql.util.PSQLException: ERROR: invalid Unicode escape
Hint: Unicode escapes must be \uXXXX or \UXXXXXXXX.