How do you create a new driver instance?
Create a new driver instance
Complete the code below to create a new driver instance.
Java
final String NEO4J_URI = "neo4j://localhost:7687"
final String NEO4J_USERNAME = "neo4j"
final String NEO4J_PASSWORD = "letmein"
var driver = GraphDatabase./*select:driver(*/(
NEO4J_URI,
AuthTokens.basic(
NEO4J_USERNAME,
NEO4J_PASSWORD)
);
-
❏
connect
-
✓
driver
-
❏
GraphDatabase
-
❏
new_driver
Hint
What is the name of the object used to connect a Neo4j instance?
Solution
The method to create a new connection is GraphDatabase.driver()
.
Java
var driver = GraphDatabase.driver(
NEO4J_URI,
AuthTokens.basic(
NEO4J_USERNAME,
NEO4J_PASSWORD)
);
Summary
You can now install the neo4j
library and connect to Neo4j by creating a new driver instance.
In the next lesson, you will learn how to execute your first Cypher query.