Skip to content

Commit b9d238d

Browse files
technigeZhen Li
authored andcommitted
Updated first half
1 parent c40ce59 commit b9d238d

File tree

1 file changed

+43
-28
lines changed

1 file changed

+43
-28
lines changed

README.md

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,52 @@
11
# Neo4j Java Driver
22

3-
This is the official Neo4j java driver for connecting to a Neo4j database or a Neo4j cluster via in-house binary protocol Bolt.
3+
This repository holds the official Java driver for Neo4j.
4+
The API is designed to work against both single instance and clustered databases.
5+
46

57
## For Driver Users
68

7-
This section provides some useful information for application developers
8-
who would like to use this driver in their projects to send queries to their Neo4j database and/or Neo4j cluster.
9+
This section provides general information for developers who are building Neo4j-backed applications.
10+
Note that this driver is designed to be used only by Neo4j 3.0 and above and provides no HTTP capabilities.
911

10-
### Java Runtime
1112

12-
Since 1.5 series, the driver supports Java 8 and Java 9 runtime.
13-
The automatic module name of the driver required by Java 9 is `org.neo4j.driver`.
13+
### Java Runtime
1414

15-
The table bellow shows all driver series and supported Java runtime.
15+
Recent drivers require either the Java 8 or Java 9 runtime.
16+
The table below shows runtime compatiblity for the currently-supported driver versions.
1617

17-
| Driver Series | 1.5 and above | 1.4 and bellow |
18-
| ---------------------:|:-----------------:|:-----------------:|
19-
| Supported Java Runtime| Java 8 and Java 9 | Java 7 and Java 8 |
18+
| Driver Series | Java 7 | Java 8 | Java 9 |
19+
|---------------|:------:|:------:|:------:|
20+
| 1.3 | X | X | |
21+
| 1.4 | X | X | |
22+
| 1.5 | | X | X |
23+
| 1.6 | | X | X |
2024

25+
The automatic module name of the driver required by Java 9 is `org.neo4j.driver`.
2126

2227

23-
### Minimum Viable Snippet
28+
### The `pom.xml` file
2429

25-
The driver is distributed via Maven exclusively.
26-
To use the driver in your Maven project:
30+
The driver is distributed exclusively via [Maven](https://search.maven.org/).
31+
To use the driver in your Maven project, include the following within your `pom.xml` file:
2732
```xml
2833
<dependency>
2934
<groupId>org.neo4j.driver</groupId>
3035
<artifactId>neo4j-java-driver</artifactId>
3136
<version>x.y.z</version>
3237
</dependency>
3338
```
34-
The version `x.y.x` need to be replaced with a released driver version.
35-
The latest driver version is always recommended for accessing newest features and recent bug fixes.
36-
The latest and all available versions of this driver could be found at
39+
Here, `x.y.z` will need to be replaced with the appropriate driver version.
40+
It is generally recommended to use the latest driver version wherever possible.
41+
This ensures access to new features and recent bug fixes.
42+
All available versions of this driver can be found at
3743
[Maven Central](https://mvnrepository.com/artifact/org.neo4j.driver/neo4j-java-driver) or
3844
[Releases](https://github.com/neo4j/neo4j-java-driver/releases).
3945

4046

41-
To connect to a Neo4j 3.0.0+ database:
47+
### Example
48+
49+
To run a simple query, the following can be used:
4250
```java
4351
Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic( "neo4j", "PasSW0rd" ) );
4452
try ( Session session = driver.session() )
@@ -47,27 +55,34 @@ try ( Session session = driver.session() )
4755
}
4856
driver.close();
4957
```
50-
While using this driver in an application project, we recommend **a single driver** during the whole lifetime of the application
51-
to benefit from the connection pool maintained in the `driver` object.
5258

53-
The `driver` object holds a connection pool to avoid performance overhead added by establishing TCP connections for each query run.
54-
Network connections are established on demands when running Cypher queries, and returned back to connection pool after query execution finishes.
55-
As a result, it is expensive to create and close driver, while super cheap to open and close sessions.
59+
For full applications, a single ``Driver`` object should be created with application-wide scope and lifetime.
60+
This allows full utilization of the driver connection pool.
61+
The connection pool reduces network overhead added by sharing TCP connections between subsequent transactions.
62+
Network connections are acquired on demand from the pool when running Cypher queries, and returned back to connection pool after query execution finishes.
63+
As a result of this design, it is expensive to create and close a ``Driver`` object.
64+
``Session`` objects, on the other hand, are very cheap to use.
5665

57-
The driver is thread-safe, but the session or transaction is not thread-safe.
58-
So make sure make sure `Session` and `Transaction` objects are not used concurrently by multiple threads.
5966

60-
### More Manual and Documents
67+
### Thread Safety
68+
69+
``Driver`` objects are thread-safe, but ``Session`` and ``Transaction`` objects should only be used by a single thread.
70+
71+
72+
### Further reading
6173
Check out our [Wiki](https://github.com/neo4j/neo4j-java-driver/wiki) for detailed and most up-to-date developer manuals, driver API documentations, changelogs, etc.
6274

75+
6376
### Bug Report
64-
If you encounter any bugs while using this driver, please following the instructions in our [Contributing Criteria](https://github.com/neo4j/neo4j-java-driver/blob/1.6/CONTRIBUTING.md#need-to-raise-an-issue)
77+
If you encounter any bugs while using this driver, please follow the instructions in our [Contribution Guide](https://github.com/neo4j/neo4j-java-driver/blob/1.6/CONTRIBUTING.md#need-to-raise-an-issue)
6578
when raising an issue at [Issues](https://github.com/neo4j/neo4j-java-driver/issues).
6679

67-
When reporting, please mention the version of the driver and version of the server, the setup of the server such as single instance or HA or causal cluster,
68-
the error stacktrace, code snippet to reproduce the error if possible, and anything that you think it is helpful to reproduce the error.
80+
When reporting, please mention the versions of the driver and server, as well as the server topology (single instance, causal cluster, etc).
81+
Also include any error stacktraces and a code snippet to reproduce the error if possible, as well as anything else that you think might be helpful.
82+
6983

7084
## For Driver Developers
85+
7186
This section targets at people who would like to compile the source code on their own machine for the purpose of, for example, contributing a PR to this repository.
7287
Before contributing to this project, please take a few minutes and read our [Contributing Criteria](https://github.com/neo4j/neo4j-java-driver/blob/1.6/CONTRIBUTING.md#want-to-contribute).
7388

0 commit comments

Comments
 (0)