Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

neo4j LOAD CSV returns Couldn't Load external resource - neo4j lost in directory

Since I use Neo4j 3.0.1, this cypher query:

USING PERIODIC COMMIT 500  
 LOAD CSV WITH HEADERS  
 FROM >"file:///home/user/Documents/links.csv" AS csvLine  

...

returns

Couldn't load the external resource at: file:/home/user/Documents/neo4j-community-3.0.1/import/home/user/Documents/links.csv

Neo4j is located on my machine (Ubuntu 14.04), in the "Documents" folder, as the "links.csv" file.

(with a 2.xx version of neo4j this exact query was working perfectly)

I don't undersand why neo4j3.0 try to rebuild the csv file path in the "import" folder...
Uploading the file on ftp to query neo4j through http protocol works, so it's not about access permissions of the "import "folder". My "links.csv" file permission is 664.

Any idea ?

like image 593
mquantin Avatar asked May 25 '16 17:05

mquantin


2 Answers

This is a security that has been integrated in neo4j 3.0 in order to prevent scripts to load sources from an unwanted directory (like /etc/password for example.

You can add the following setting in conf/neo4j.conf in order to bypass this :

dbms.security.allow_csv_import_from_file_urls=true

Or just put your csv files in the import directory.

like image 85
Christophe Willemsen Avatar answered Sep 23 '22 15:09

Christophe Willemsen


You should comment out this line from the neo4j.conf line:

    dbms.directories.import=import

or set the files at the import

like image 42
Ran Adler Avatar answered Sep 24 '22 15:09

Ran Adler