Skip to content

Commit bd0a8fc

Browse files
authored
Update Example in README (#1306)
1 parent 0b9eb38 commit bd0a8fc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ Starting from version 5.0 the `neo4j-java-driver` includes an explicit module de
5252

5353
To run a simple query, the following can be used:
5454
```java
55-
Driver driver = GraphDatabase.driver("bolt://localhost:7687", AuthTokens.basic("neo4j", "PasSW0rd"));
56-
try (Session session = driver.session()) {
57-
Result result = session.run("CREATE (n) RETURN n");
55+
var authToken = AuthTokens.basic("neo4j", "password");
56+
try (var driver = GraphDatabase.driver("bolt://localhost:7687", authToken); var session = driver.session()) {
57+
var result = session.run("CREATE (n)");
58+
var summary = result.consume();
59+
System.out.println(summary.counters().nodesCreated());
5860
}
59-
driver.close();
6061
```
6162

6263
For full applications, a single ``Driver`` object should be created with application-wide scope and lifetime.

0 commit comments

Comments
 (0)