Fred
Fred

Reputation: 830

mysql ,"load data in file" , wrong file path

I'm trying to upload the contents of a text file using this:

  myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/sys", "root", "*****8");

        Statement myStmt = myConn.createStatement();

        String sql="LOAD DATA INFILE"+ "'C:\\Users\\willf\\Documents\\comps sci\\NEA\\V1.4\\map files\\map.txt'"+"INTO TABLE sys.mazes";


        myStmt.executeUpdate(sql);

"java.sql.SQLException: File 'C:\ProgramData\MySQL\MySQL Server 8.0\Data\UserswillfDocumentscomps sciNEAV1.4map filesmap.txt' not found (OS errno 2 - No such file or directory)"

As you can see the filepath is completely different to what i'm giving it.

Upvotes: 0

Views: 204

Answers (1)

Yserbius
Yserbius

Reputation: 1414

MySQL is looking for a relative path using forward slashes. Try this instead: "'/C:/Users/willf/Documents/comps sci/NEA/V1.4/map files/map.txt'"

Upvotes: 1

Related Questions