E. Rowlands
E. Rowlands

Reputation: 343

Does JDBC have a relative path option when using LOAD DATA LOCAL INFILE?

I'd like to load a text file that is located in a NetBeans project folder.

What is the default relative path (if one exists in JDBC) of the LOAD DATA LOCAL INFILE command? (MySQL syntax)

I would have assumed it would be the home directory of the compiled code - but it has given me the expected SQL exceptions for not being able to find the file.

I have to hand in an assignment - and so cannot use an absolute path as that would not work on another computer.

Upvotes: 1

Views: 754

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521249

From the MySQL documentation for LOAD DATA LOCAL INFILE:

If LOCAL is specified, the file is read by the client program on the client host and sent to the server. The file can be given as a full path name to specify its exact location. If given as a relative path name, the name is interpreted relative to the directory in which the client program was started.

You should try using the location of the client program as being the start of the relative path. The directory of the compiled code does not seem to have anything to do with this.

Upvotes: 1

Related Questions