public interface Driver extends AutoCloseable
Driver implementations are typically thread-safe, act as a template
for Session creation and host a connection pool. All configuration
and authentication settings are held immutably by the Driver. Should
different settings be required, a new Driver instance should be created.
A driver maintains a connection pool for each remote Neo4j server. Therefore the most efficient way to make use of a Driver is to use the same instance across the application.
To construct a new Driver, use one of the
GraphDatabase.driver methods.
The URI passed to
this method determines the type of Driver created.
| URI Scheme | Driver |
|---|---|
bolt |
Direct driver: connects directly to the host and port specified in the URI. |
bolt+routing |
Routing driver: can automatically discover members of a Causal Cluster and route sessions based on AccessMode. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close all the resources assigned to this driver, including any open connections.
|
boolean |
isEncrypted()
Return a flag to indicate whether or not encryption is used for this driver.
|
Session |
session()
Create a new general purpose
Session. |
Session |
session(AccessMode mode)
Create a new
Session for a specific type of work. |
Session |
session(AccessMode mode,
String bookmark)
Create a new
Session for a specific type of work with the specified initial bookmark. |
Session |
session(String bookmark)
|
boolean isEncrypted()
Session session()
Session.
Alias to session(AccessMode.WRITE, null).
Session object.Session session(AccessMode mode)
Session for a specific type of work.
Alias to session(mode, null).
mode - the type of access required by units of work in this session,
e.g. read access.Session object.Session session(String bookmark)
write Session with the specified initial bookmark.
First transaction in the created session will ensure that server hosting is at least as up-to-date as the
transaction referenced by the supplied bookmark.
Alias to session(AccessMode.WRITE, bookmark).
bookmark - the initial reference to some previous transaction. A null value is permitted, and
indicates that the bookmark does not exist or is unknown.Session object.Session session(AccessMode mode, String bookmark)
Session for a specific type of work with the specified initial bookmark.
First transaction in the created session will ensure that server hosting is at least as up-to-date as the
transaction referenced by the supplied bookmark.mode - the type of access required by units of work in this session,
e.g. read access.bookmark - the initial reference to some previous transaction. A null value is permitted, and
indicates that the bookmark does not exist or is unknown.Session object.void close()
close in interface AutoCloseableCopyright © 2017. All rights reserved.