简体   繁体   English

如何检查Neo4j数据库是否在给定位置

[英]How to check if a Neo4j database existis at a given location

Calling 呼唤

new GraphDatabaseFactory().newEmbeddedDatabase(File storeDir);

in the Neo4j Java API not only opens a database at a given location but also creates one if it doesn't already exist. Neo4j Java API中的Java API不仅可以在给定位置打开数据库,而且还可以创建一个不存在的数据库。

I would like to check if a Neo4j database exists in a given directory without creating one if it doesn't. 我想检查Neo4j数据库是否存在于给定目录中,如果不存在则不创建数据库。 How can I accomplish that? 我该怎么做?

I now do this by checking if there is a neostore file in the store directory and by trying to get it's version. 现在,我通过检查store目录中是否有neostore文件并尝试获取其版本来进行此操作。

See how you can get the store version here: Determine Neo4j database version 在此处查看如何获取商店版本: 确定Neo4j数据库版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM