I don't understand why this would be happening. Are you sure that the data is stored in the database correctly? It's possible that the SQL statement which originally stored the data did not perform a required escape. (Assuming \ has special significance in some forms of SQL - dunno.) One way to avoid needing additional escapes may be to use PreparedStatement rather than Statement to do your insert/updates.
If the data is correct in the database but not after it's been read and written to a file, that's very strange. Try inserting a System.out.println() to display the data after it's been read and before it's been written - this way you can determine if the problem is with the read or the write. Then show us the code that you use to perform the read or write.
Although \ is treated as a special escape characer when it's encountered in a
String or char literal in a Java source file which is being compiled, most other methods which read and write do
not treat \ as anything special. (SQL to insert or update may be an exception.) I'll be interested to hear where this problem really comes from.