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.
second variation is correct. I'm not sure about syntax errors you get, but to get single backslash you need to escape it twice, once with java, and again in SQL, which results in 4 backslashes. ´ I verified that unit test below succeeds
@Test public void escaping() throws Exception { Statement st = connection.createStatement(); ResultSet rs = st.executeQuery("select '
'"); rs.next(); assertEquals("
", rs.getString(1)); }