Comments - How to escape backslash in an insert statement

10 years ago Vladislav Vaintroub
This comment has the status of 'removed' and can only be seen by you.

You need to pass "

" as string constant. Since both java and MySQL requires escaping of slashes, "

" is double slash in Java, passed to MySQL it will be a single slash.

You also can use hexadecimal value of slash (in ASCII) which is , e.g

"insert into table(t) values (0x5C)" will insert backslash in char column

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.