【问题标题】:How can I connect to Neo4J embedded instance using reactive driver?如何使用响应式驱动程序连接到 Neo4J 嵌入式实例?
【发布时间】:2020-02-11 09:55:56
【问题描述】:

到目前为止,我一直在使用此代码连接到嵌入式 Neo4J 实例:

DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(new File("neo")).build();
GraphDatabaseService graphDb = managementService.database(DEFAULT_DATABASE_NAME);

(使用this

现在,我切换到Neo4J driver。但我不知道如何连接到嵌入式数据库。我试过这个:

Driver driver = GraphDatabase.driver("bolt://localhost:7687");

但显然无法正常工作,因为没有运行 Neo4J 服务器,而只是一个数据库文件。我想我需要先运行bolt server,暴露neo dir,这是我的数据库所在的位置。我该怎么做?

【问题讨论】:

    标签: java neo4j bolt


    【解决方案1】:

    深入研究代码后,我发现这段代码:

    DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(new File("neo")).build();
    

    实际上启动了一个bolt服务器。所以我这样做了:

    DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(new File("neo")).build();
    Driver driver = GraphDatabase.driver("bolt://localhost:7687");
    

    一切都开始工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-13
      • 1970-01-01
      • 2022-12-07
      • 1970-01-01
      • 1970-01-01
      • 2017-04-05
      • 1970-01-01
      相关资源
      最近更新 更多