I am trying to update text into a MySql Database. The text contains " marks in it. As example string could be Hello "world" now when i write insert command its sumthing like
insert into mytable ('mystring') values("Hello "world"");
I am using java to execute a command like this. Obviously this gives an error due to the double quotes in the world string. I tried replacing it with java
givenString.replaceAll("\"", "\\"");
givenString.replace(Pattern.quote("\""), "\\"");
But nothing works . Any help is greatly appreciated !
` in the text. Or control characters, or whatever. Best stick withPreparedStatement`. And that's general to avoid injection attacks when producing any text format.