mostafa shendi
mostafa shendi

Reputation: 11

Error on import data neo4j

** LOAD CSV WITH HEADERS FROM "file:///C:/coursera/data/test.csv" AS line
MERGE (n:MyNode {Name:line.Source})
MERGE (m:MyNode {Name:line.Target})
MERGE (n) -[:TO {dist:line.distance}]-> (m)**

I have the mention error:

Couldn't load the external resource at: file:/C:/Users/mshendi/Documents/Neo4j/default.graphdb/import/coursera/data/test.csv

Upvotes: 1

Views: 194

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41676

Either you put the file into an import directory. If you're on windows using the Neo4j desktop then the import directory has to go into the database directory (side by side with plugins).

If you use the zip distribution or Neo4j Enterprise it's in $NEO4J_HOME/import.

Otherwise you have to disable the security setting in neo4j.conf or change it pointing to your data directory.

# This setting constrains all `LOAD CSV` import files to be under the `import` directory. Remove or comment it out to
# allow files to be loaded from anywhere in the filesystem; this introduces possible security problems. See the
# `LOAD CSV` section of the manual for details.
dbms.directories.import=import

If you ever want to restrict loading from a file-URL you have to disable this:

# Determines if Cypher will allow using file URLs when loading data using
# `LOAD CSV`. Setting this value to `false` will cause Neo4j to fail `LOAD CSV`
# clauses that load data from the file system.
#dbms.security.allow_csv_import_from_file_urls=true

Upvotes: 2

Related Questions