I am storing a file path in my database:
the
selecteddestinationfilepath = selectedPfile.getPath();
.
.
.
state.execute("INSERT INTO "+tablename+" (filename,filepath) VALUES ('"+theselecteddestinationname+"','"+theselecteddestinationfilepath+"')");
But when it is stored into the database it throws away all the “\”
so instead of D:\Programs\Rynmag181 -TFC
its D:ProgramsRynmag181 -TFC
how can I fix that?
Use a PreparedStatement, with
VALUES(?, ?)andsetParam(1, thesel...);setParam(2, ...),This also prevents SQL injection and does several forms of escaping.