Romeo
Romeo

Reputation: 11

How to connect a jupyterNotebook in jupyterLab with Neo4j

I want to access my database (which is saved and runs in Neo4j Desktop) from a jupyterNotebook which is runing in jupyterLab. However I am getting this error:

ServiceUnavailable: Couldn't connect to 127.0.0.1:7687 (resolved to ()):
Failed to establish connection to ResolvedIPv4Address(('127.0.0.1', 7687)) (reason [Errno 111] Connection refused)

**This is my code: ** **Example how to connect with Neo4j **

from neo4j import GraphDatabase
import pandas as pd

uri = "bolt://127.0.0.1:7687"
username = "XXX"
password = "XXX"
driver = GraphDatabase.driver(uri, auth=(username, password))

query = """
MATCH (t:Task)-[:BELONGS_TO]->(g:GroundTruth)
RETURN t.name, g.id
LIMIT 5
"""

with driver.session() as session:
result = session.run(query)
data = pd.DataFrame(result.data())

print(data)

If i run that code in VSC, it works perfectly; but not from JupyterLab.

Does someone know a sloution?

I already did this changes in the Neo4j Settings:

dbms.connector.bolt.enabled=true
dbms.connector.bolt.listen_address=0.0.0.0:7687

Upvotes: 1

Views: 93

Answers (0)

Related Questions