File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -52,11 +52,12 @@ Starting from version 5.0 the `neo4j-java-driver` includes an explicit module de
52
52
53
53
To run a simple query, the following can be used:
54
54
``` 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());
58
60
}
59
- driver. close();
60
61
```
61
62
62
63
For full applications, a single `` Driver `` object should be created with application-wide scope and lifetime.
You can’t perform that action at this time.
0 commit comments