Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Changing database on the fly, before a save

Node Link

I am looking for the most simple way to be able to switch dynamically from one database to another.
I am using the latest neo4j enterprise version in a docker.

Here is my use case in details:

    neo4jConfiguration.useDatabase("myDb"); // Should be able to switch to any database name here
    Folder folder = new Folder("path");;
public class Neo4jConfiguration {

  private final SessionFactory sessionFactory;

  public Neo4jConfiguration(SessionFactory sessionFactory) {
    this.sessionFactory = sessionFactory;

  public void useDatabase(final String dbName) {
    // How to switch database on the fly? my user is admin and can access all database created
    Session session = sessionFactory.openSession();
    session.query("USE " + dbName, Collections.EMPTY_MAP);

  public void executeStuffForTest() {
    Session session = sessionFactory.openSession();
    session.query("MATCH (n) DETACH DELETE n", Collections.EMPTY_MAP);
    session.query("CREATE (n:Person { name: 'Maximus', title: 'Developer' })", Collections.EMPTY_MAP);

I have read on fabric, that looks really overkill and really complex for what I want, also would like to stick to the standard spring-boot framework. Is it possible to achieve my use case?


Node Link

Is neo4j/sdn-rx the easiest solution to implement this?

Was able to achieve this with sdn-rx

Here is a good example