java neo4j配置,如何使用Java连接到本地安装的neo4j服务器

I'm new to Neo4J and couldn't find the answer to my question despite my hours of googling.

So far, I have been following the tutorials and now I have a basic understanding of how/when to use Neo4j. Now, I am about to start modifying my hello-world code and connect to a Neo4J server locally installed on my machine, accessible via http://127.0.0.1:7474.

Original connection (using an embedded database):

GraphDatabaseService gdb = new EmbeddedGraphDatabase("c:\\helloworld\\data\\graph.db");

The question is is there anyway to modify this line to connect to my "server" database in c:\neo4j\data\graph.db instead? The server is running currently as a windows service and I can view its database using the web admin tool. At this time, I am not interested in using the REST API since the server and the client app are running on the same machine.

I feel like I'm missing something obvious here...

解决方案

The windows service exposes the REST interface.

The embedded interface is entirely different - you point it at the database file structure and then access it via Java method calls.

If you have both running at the same time, pointing at the same data, then bad things might happen (actually, I think it detects this and prevents it). So you probably need to stop the service and/or backup the data from this instance to another directory. Then edit your EmbeddedGraphDatabase constructor to point to this directory.

The manual describes the embedded Java interface, as you've probably seen. See also this section which briefly mentions the rather nice web-based management interface.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值