Connect to Neo4j specific database

Hi,

I am new to neo4j.
I am able to use this neo4j client to connect to the database

As i know there is a parameter in setting dbms.default_database that will select the default database.
When making connection to database from PHP, is it possible to choose which database to use?

Thanks.

Hello @kk.teoh ,

It is posible to change the database name when creating a driver in the URI like this:

$client = ClientBuilder::create()->withDriver('bolt://test:mypassword@localhost?graph=my-graph')->build()

Or with a default session configuration like this:

 $client = ClientBuilder::create()
            ->withDriver('bolt://test:mypassword@localhost')
            ->withDefaultSessionConfiguration(SessionConfiguration::default()->withDatabase('my-graph'))
            ->build();

You can even decide ad hoc to change the driver like this:

$session = $client->getDriver('default')
            ->createSession(SessionConfiguration::default()->withDatabase('my-graph'));

$session->run('my awesome query');

Hope this helps!