Showing results for 
Search instead for 
Did you mean: 

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

Addressing multi-databases from Java

Dear community,

I started having a go at multi-databases. I get how you can create and switch between databases in the browser by e.g.

:use system
create database newDatabase
:use newDatabase

Is it also possible to achieve the same using a java programme?

I have in mind something like:

session = driver.session();
session.writeTransaction((Transaction tx) -> {":use system");
  return 1;
session.writeTransaction((Transaction tx) -> {"create database newDatabase");
  return 1;

session.writeTransaction((Transaction tx) -> {":use newDatabase");
  return 1;

Has anyone done anything similar?


Node Clone

I don't believe you can change databases within a session.
The database you connect to is specified at session creation time via SessionConfig. The default session config chooses the default database of the server.

Docs here: