Neo4j Embedded Mode with Password

天涯浪子 提交于 2019-12-12 03:54:48

问题


Can you connect to Neo4j in embedded mode in a Java application to connect to an existing running Neo4J server that requires a username and password?

How do you do that? Apparently without authentication it is:

graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( DB_PATH );
registerShutdownHook( graphDb );

回答1:


Http authentication is part of the Neo4j server component. The code snippet that you're using runs an embedded database instance.

Please clarify your question if a) you want some code connecting to a running Neo4j remote instance or b) you want to run your own embedded instance and run the web interface on top of it?

In case of a) you can either work with the transactional Cypher endpoint, use Neo4j JDBC driver or (starting with Neo4j) the java bolt driver.

In case of b) you need to look at Neo4j's source code to understand what org.neo4j.server.Bootstrapper and its derived classes are doing. With those you can run your server on top of an embedded instance.



来源:https://stackoverflow.com/questions/35488238/neo4j-embedded-mode-with-password

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!