Cypher Neo4j Couldn't load the external resource

前端 未结 15 1716
谎友^
谎友^ 2021-02-07 05:09

In a Windows environment, I\'m trying to load a .csv file with statement:

LOAD CSV WITH HEADERS FROM \"file:///E:/Neo4j/customers.csv\" AS row

相关标签:
15条回答
  • 2021-02-07 05:26

    I was getting this error on Community Edition 3.0.1 on Mac OS X 10.10 It appears that the LOAD CSV file:/// looks for files in a predefined directory. One would think that in the argument that one would give the Cypher statement the full path but that is not the case.

    The file:/// - for my situation" meant that neo4j would append the given argument you gave to one that was already predefined and then go look for that combined path The file:/// pre-defined directory directory did not exist entirely /Users/User/Documents/Neo4j/default.graphdb/import, in my computers directory structure I was missing the "/import" folder, which was not created at install

    To fix on my system, I created an "import" directory, put the file to be read in that directory. I executed the Cypher load statement I ONLY put the name of the file to be read in the file argument i.e.

    LOAD CSV file:///data.csv
    

    this worked for me.

    0 讨论(0)
  • 2021-02-07 05:28

    You can find the answer in the file

    "C:\Users\Jack\AppData\Roaming\Neo4j Community Edition\neo4j.conf"
    

    (above "dbms.directories.import=import")

    For version neo4j-community_windows-x64_3_1_1 you have to comment out this line or you have to create the folder \import (which isn´t created through the installation) and add your file into the folder.


    There it´s written that due to security reasons they only allow file load from the \Documents\Neo4j\default.graphdb\import folder

    After commenting out on # dbms.directories.import=import , you can execute e.g. from

    LOAD CSV FROM "file:///C:/Users/Jack/Documents/products.csv" AS row 
    

    In neo4j.conf I didn´t have to add/set

    dbms.security.allow_csv_import_from_file_urls=true
    
    0 讨论(0)
  • 2021-02-07 05:33

    In the Neo4j desktop select the database you are using, go to the setting and there you will find the solution... just comment the "dbms.directories.import=import" line

    # 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 ### COMMENT THIS LINE

    0 讨论(0)
  • 2021-02-07 05:35

    It appears to be a security configuration. Here's the original answer I found: https://stackoverflow.com/a/37444571/327004

    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 change the import directory dbms.directories.import=import

    0 讨论(0)
  • 2021-02-07 05:35

    It's probably an URL issue, try file:c:/path/to/data.csv

    See my blog posts:

    • http://jexp.de/blog/2014/10/load-cvs-with-success/
    • http://jexp.de/blog/2014/06/load-csv-into-neo4j-quickly-and-successfully/
    0 讨论(0)
  • 2021-02-07 05:36

    you put your dataset into the import directory in neo4j-community path. Then re-run your command.

    0 讨论(0)
提交回复
热议问题