使用Java应用程序中嵌入的Neo4j

时间:2018-11-22 19:22:43

标签: java neo4j cypher neo4j-embedded

我正在尝试使用Java应用程序中嵌入的Neo4j,并且正在使用以下代码:

this.items.push({...this.template})

但是我得到了这个例外:

package com.tp.neo4j.java.examples;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
public class Neo4jJavaAPIDBOperation {
  public static void main(String[] args) {
    GraphDatabaseFactory dbFactory = new GraphDatabaseFactory();
    GraphDatabaseService db = dbFactory.newEmbeddedDatabase("C:/TPNeo4jDB");
    try (Transaction tx = db.beginTx()) {
        // Perform DB operations    
        tx.success();
    }   
 }
}

任何想法,请

1 个答案:

答案 0 :(得分:2)

newEmbeddedDatabase期望File作为参数

GraphDatabaseService db = dbFactory.newEmbeddedDatabase(new File("C:/TPNeo4jDB"));