I have a common task, though can't figure out the problem with backslashes.
MySql table "MyTable" records pathes to files in the column "path_file".
In java:
String filename = "c:\temp\infile.txt";
filename.replaceAll("\\\\", "\\\\\\\\\\\\\\\\"));
String sql = "UPDATE MyTable SET path_file ='" + filename + "' WHERE File =" + File_ID;
stmt.executeUpdate(sql);
Java results in: c:\\\\temp\\\\infile.txt
MySql strippes all backslashes: c:tempinfile.txt
When directly working with Mysql MyTable in Mysql:
UPDATE MyTable SET path_file = "c:\\temp\\infile.txt" WHERE File = 1;
MySql MyTable records the correct result: c:\temp\infile.txt
Any idea?