Showing results for 
Search instead for 
Did you mean: 

Use neo4j java driver to connect neo4j DB by database name


Can I have an example of java application connecting to neo4j database by specifying a database name? I have multiple databases but need to connect to only one.

This is what I have now, it works but only connects to default neo4j database, and I need to connect to another database:


Node Clone

@adellalin You need to specify the database name as parameter while creating the session like driver.session( database=XXXX)

Node Link

Hello @adellalin ,

I ran into a similar issue. I am using driver session object to create a connection. When i go to create my session before i query i specify the database i want to use by the below command.

Session session = driver.session(SessionConfig.forDatabase(XXXXXXX)))

XXXXXX = being the name of the database you want to use.

Nodes 2022
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.