Comments - How to escape backslash in an insert statement
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
Your second variant is correct.
I can run it without any errors (assuming I have table test with varchar(10) columns "name " and "value"), and it produces the correct result with single backslash character.
Thanks. I did some more testing with the seconds variant. It works fine when I use regular JDBC. It was giving the error when ran the update via Spring JDBC Template.
I was using it like below: jdbcTemplate.update(stmt, new Object[0]); This uses prepared statement internally
It works fine if I don't pass the empty argument list. jdbcTemplate.update(stmt); works
Not sure why it is different. Anyway, I can use the option without the argument list.
Thanks! Manju