[英]Using neo4j database in eclipse project
I'm working on an webserver project with tomact. 我正在开发一个带有tomact的webserver项目。 I have a dataBase in neo4j.
我在neo4j中有一个dataBase。 How can I link it to the dataBase?
如何将其链接到dataBase? I want to get information from there and also add new data, in the servlets that I created.
我想从那里获取信息,并在我创建的servlet中添加新数据。 I tried running the dataBase in the background But i still get "Forbidden (403) - Forbidden" in my project.
我尝试在后台运行dataBase但我仍然在我的项目中得到“Forbidden(403) - Forbidden”。 Do I have to set it somehow?
我必须以某种方式设置它吗? I'm using eclipse, how can I do that?
我正在使用eclipse,我该怎么做?
You can try this approach: 你可以尝试这种方法:
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
// ...
public static void main(String[] args) {
GraphDatabaseFactory graphDbFactory = new GraphDatabaseFactory();
GraphDatabaseService graphDb = graphDbFactory.newEmbeddedDatabase("path_to_neo4j_database/your_database_folder");
try (Transaction tx = graphDb.beginTx()) {
// use graphDb object to manipulate the DB content
tx.success();
}
graphDb.shutdown();
System.out.println("Done :) ");
}
// ...
And don't forget to add the Neo4j library to build path: 并且不要忘记添加Neo4j库来构建路径:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.