Ciro Pinto-Coelho
Ciro Pinto-Coelho

Reputation: 51

Creating a Bolt Connection to an Embedded Neo4j Database

I'm struggling to establish a bolt connection between my embedded Neo4j database and the Neo4j browser. I'd like to use the browser to visualize my databases to ensure the nodes and relationships are properly recorded by my java code.

I've written the code snippet below that creates the Neo4j database, created the nodes and relationships. When I launch the Neo4j desktop app and click on "Add Graph" the app prompts me for the name (graph) and URL of the graph (bolt://localhost:7687). Then the app prompts me for a username (neo4j) and password (password), which I supply. However, I did not include an authentication setting in the creation of the graph database via the GraphDatabaseFactory() method.

I tried leaving the username and password fields blank in the Neo4j desktop app, but the app objects with the following error messages "Unable to establish remote connection: Database is unreachable with specified configuration" and "Unable to establish remote connection: ServiceUnavailable."

        BoltConnector boltConnector = new BoltConnector();

        graphDataBase = new GraphDatabaseFactory()
                .newEmbeddedDatabaseBuilder(new File(databaseDirectory))
                .setConfig(boltConnector.type, "BOLT")
                .setConfig(boltConnector.enabled, "true")
                .setConfig(boltConnector.listen_address, "localhost:7687")
                .setConfig(GraphDatabaseSettings.auth_enabled, "false")
                .newGraphDatabase();

Can you please help me understand how I include the authentication via username and password in the configuration of the database via the GraphDatabaseFactory method? I've searched the documentation for the method and could not find a way to do.

Thanks in advance for your help.

Upvotes: 1

Views: 363

Answers (0)

Related Questions