I'm inserting text from a Java application into a Postgresql database, but it all crashes when a ' char is encountered in the String. I've tried using replaceAll(" ' ", " \\' "); even diffrent variants of it with more \ chars, yet it still puts a single ' in the String without the escape sign.
Is there any way of replacing the ' with an \' in the String? Or another way of putting Strings containig single quotes into Postgresql?