Unable to open file 'article.csv'for 'LOAD DATA LOCAL INFILE' command
已回答
HI,
I want to load csv files into a sql file with this command:
LOAD DATA LOCAL INFILE 'article.csv' INTO TABLE article
FIELDS TERMINATED BY ',';
But Datagrip return me this error:
[2019-01-20 14:29:11] [S1009] Unable to open file 'article.csv'for 'LOAD DATA LOCAL INFILE' command.Due to underlying IOException:
[2019-01-20 14:29:11] ** BEGIN NESTED EXCEPTION **
[2019-01-20 14:29:11] java.io.FileNotFoundException
[2019-01-20 14:29:11] MESSAGE: article.csv (Aucun fichier ou dossier de ce type)
[2019-01-20 14:29:11] STACKTRACE:
[2019-01-20 14:29:11] java.io.FileNotFoundException: article.csv (Aucun fichier ou dossier de ce type)
[2019-01-20 14:29:11] at java.io.FileInputStream.open0(Native Method)
[2019-01-20 14:29:11] at java.io.FileInputStream.open(FileInputStream.java:195)
[2019-01-20 14:29:11] at java.io.FileInputStream.<init>(FileInputStream.java:138)
[2019-01-20 14:29:11] at java.io.FileInputStream.<init>(FileInputStream.java:93)
[2019-01-20 14:29:11] at com.mysql.jdbc.MysqlIO.sendFileToServer(MysqlIO.java:3815)
[2019-01-20 14:29:11] at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3113)
[2019-01-20 14:29:11] at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2344)
[2019-01-20 14:29:11] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2739)
[2019-01-20 14:29:11] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2482)
[2019-01-20 14:29:11] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2440)
[2019-01-20 14:29:11] at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:845)
[2019-01-20 14:29:11] at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:745)
[2019-01-20 14:29:11] at com.intellij.database.remote.jdbc.impl.RemoteStatementImpl.execute(RemoteStatementImpl.java:78)
[2019-01-20 14:29:11] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2019-01-20 14:29:11] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[2019-01-20 14:29:11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2019-01-20 14:29:11] at java.lang.reflect.Method.invoke(Method.java:498)
[2019-01-20 14:29:11] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
[2019-01-20 14:29:11] at sun.rmi.transport.Transport$1.run(Transport.java:200)
[2019-01-20 14:29:11] at sun.rmi.transport.Transport$1.run(Transport.java:197)
[2019-01-20 14:29:11] at java.security.AccessController.doPrivileged(Native Method)
[2019-01-20 14:29:11] at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
[2019-01-20 14:29:11] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
[2019-01-20 14:29:11] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
[2019-01-20 14:29:11] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
[2019-01-20 14:29:11] at java.security.AccessController.doPrivileged(Native Method)
[2019-01-20 14:29:11] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
[2019-01-20 14:29:11] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[2019-01-20 14:29:11] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[2019-01-20 14:29:11] at java.lang.Thread.run(Thread.java:745)
[2019-01-20 14:29:11] ** END NESTED EXCEPTION **
It is not an error of code because the csv file load when I use the classic mysql console.
Do you have an idea to fix this error?
请先登录再写评论。
But when you run code from DataGrip the relative path will not work. Please use the absolute path.