how to import csv file into neo4j NumberFormatException

烈酒焚心 提交于 2019-12-11 12:57:24

问题


I have followed steps of maxdemarzi. And i took the csv datas of this example. However, it took this error when execute this command.

java -server -Dfile.encoding=UTF-8 -Xmx4G -jar batch-import-jar-with-dependencies.jar neo4j/data/graph.db BeerNodes.csv BeerRelationships.csv

Usage: Importer data/dir nodes.csv relationships.csv [node_index node-index-name
 fulltext|exact nodes_index.csv rel_index rel-index-name fulltext|exact rels_ind
ex.csv ....]
Using: Importer neo4j/data/graph.db BeerNodes.csv BeerRelationships.csv

Using Existing Configuration File

Importing 2351 Nodes took 0 seconds

Total import time: 2 seconds
Exception in thread "main" java.lang.NumberFormatException: For input string: "1
,10000,isa"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Long.parseLong(Unknown Source)
        at java.lang.Long.parseLong(Unknown Source)
        at org.neo4j.batchimport.Importer.id(Importer.java:195)
        at org.neo4j.batchimport.Importer.id(Importer.java:163)
        at org.neo4j.batchimport.Importer.importRelationships(Importer.java:129)

        at org.neo4j.batchimport.Importer.doImport(Importer.java:214)
        at org.neo4j.batchimport.Importer.main(Importer.java:78)

Any suggestions?


回答1:


Convert your csv files to use TAB as field separator.




回答2:


Either do what Stefan said, or:

Configure your importer using comma as separator, with: batch_import.csv.delim=, in your batch.properties.

See: https://github.com/jexp/batch-import#csv-experimental



来源:https://stackoverflow.com/questions/20597702/how-to-import-csv-file-into-neo4j-numberformatexception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!