Showing results for 
Search instead for 
Did you mean: 

Easiest way to query two databases (or instances) in same SDN 6 project


Hi everyone,

I am currently working with Neo4j SDN 6 using the spring repository query style + custom queries. At this point everything works as expected. However, the goal is to have two different graph representation of data, where each graph will hold data common to both plus additionnal properties based on which graph we use. In the project responsible for parsing files to create the graph data, I would like to parse the file once (time consuming operation) and populate both graphs at the same time then. I have no constraint on the architeture of the solution.

Another application will have to query both graphs independently to produce recommendations. A major difference with what I saw with Fabric is that I will not need to merge the results from both graph in a same call. I created distinct domain entities depending on the graph I use. I am not using RX as the operation of populating graph is performed once and/or databases will be updated on a regular static basis.

My questions are the following:

- Would you use one instance of Neo4j with 2 graph db, or two distinct instances of Neo4j?

- What is the easiest way to query a db from one Neo4j spring repository, and another db in another repository? For me, this would be something like annotations, to specificy the db I want to use for instance.

I saw solutions using Spring security such as the medium article here ( but I do not see the code to use it with SDN neo4j repositories, and I am a bit lost to find an easy solution to my issue.