Search code examples
neo4jr-neo4j

Accessing a local non-default database using RNeo4j


Using startGraph, I can access the default Neo4j database:

graph <- startGraph("http://localhost:7474/db/data")

which points to my default directory C:\Users\XXX\Documents\Neo4j\default.graphdb. I have a second database located at C:\Users\XXX\Desktop\New_DB\New_DB.graphdb. However, I can't figure out how to get startGraph to access that database. I've tried:

graph2 <- startGraph("file://c:/Users/XXX/Desktop/New_DB/New_DB.graphdb")

and other variations, but that doesn't work.

I'm using Neo4j 2.3.1, RNeo4j 1.6.2, Windows 10


Solution

  • RNeo4j uses the REST API to interact with Neo4j, therefore the parameter passed in startGraph needs to be a URL to a running Neo4j server instance. To access the other graph database you must stop the currently running Neo4j instance, then start the Neo4j server for the other graph database instance (the one stored at C:\Users\XXX\Desktop\New_DB\New_DB.graphdb) - or run it on a different port.

    If you are using the desktop application you can do this by clicking "Stop" then choosing the new location for the other Neo4j instance.. enter image description here