Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-09-2018 12:20 PM
Hello,
Was wondering if there was a way to check to see if the driver connected to the neo4j server when the driver was initialized, that way I can throw an error or panic when the application cannot connect to the server.
Thanks,
Matt
10-10-2018 12:58 AM
Hi @MattJBrowning,
The driver behaves in a lazy way and do not actually establish any connection on construction. The actual first contact is performed when one of session.Run
, session.BeginTransaction
, session.ReadTransaction
or session.WriteTransaction
is invoked.
As a solution, you can write your own function to test connectivity using a very simple query, like RETURN 1
.
I will also add a feature request regarding this functionality (something like driver.Verify()
returning an error
).
Thanks.
07-16-2021 12:39 PM
This is an old question but there is now an official VerifyConnectivity
function in the Driver
interface.
All the sessions of the conference are now available online