My java program collects a file path from a text field:
pathField.getText();
And inserts the results to my database (phpMyAdmin). However, it doesn't seem to include the backslashes(). EG - C:UsersSteveDesktop
The FilePath field in the database is set to "Text".
I have tested the pathField.getText() in a System.out statement, and it prints with the backslashes.
Statement st = (Statement) conn.createStatement();
String query_to_update = "INSERT INTO `evidence_db`.`mcases` ("
+ "`PID`,"
+ " `FilePath`) "
+ "VALUES ("
+ "DEFAULT,"
+ " '" + pathField.getText() + "');";
System.out.println("Query: " + query_to_update);
int val = st.executeUpdate(query_to_update);
Please note that I have edited the above code, so there might be minor errors.
/is a forward slash. You may have to escape those before inserting them into MySQL. Backslashes do for sure, not as sure with forward slashes. Either way you would escape the slash with a backslash `\`