Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-18-2021 08:44 PM
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.
12-26-2021 02:58 AM
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!
All the sessions of the conference are now available online