I noticed a weird behaviour. If the textual file from which I want to load data is under C: and the path in the sql command is specified as an absolute path, everything works fine. For example:
LOAD DATA INFILE 'C:\\mysql_test\\myfile.txt' INTO TABLE mytable ...
(double backslashes for windows compliance)
However, for personal needs, the files from which I have to load data, they have to be located in some local directory under C:, but they have to be accessed from MySQL by a network drive mapping. To be more clear, following the example above, the data file myfile.txt is located in C:\mysql_test and I defined a network drive mapping W: that is mapped on C:\mysql_test, so the file can be accessed through W:\myfile.txt.
So the file "myfile.txt" is located in C:\mysql_test
There is a network drive mapping W: pointing to C:\mysql_test
I can access the data file through W:\myfile.txt.
Remember also that for the moment, all these things are locally accessed!
So I modified the sql command in this way:
LOAD DATA INFILE 'W:\\myfile.txt' INTO TABLE mytable ...
But this does not works, giving back a "file not found" error message.
The reference manual says that this command is executed on the server and so all the paths specified have to be referred to the server.
This sounds correct to me, but in my case the server is installed locally and the path I used (W:\\myfile.txt) is absolute! Why the server doesn't find it?
LOAD DATA LOCAL INFILE 'W:\\myfile.txt' INTO TABLE mytable ...
and... suspance... it works!
But why?!?! This is perfectly correct if I'm connecting from my client application to a remote mysql server. But this is not the case! Here client and server are in the same machine. So why only the client application process (the console in my case) can see W:\myfile.txt?
And now the incredible ending. Say that my local ip is 184.108.40.206, so I can specify the path to the myfile.txt data file as "\\220.127.116.11\mysql_test\myfile.txt". The sql command become:
LOAD DATA INFILE '\\\\18.104.22.168\\mysql_test\\myfile.txt' INTO TABLE mytable ... (the double backslashes are for windows compliance)
This work!!! And there's no "local" option specified! No words.