i have a auradb sandbox for Graph data science.
i have a python notebook. it has two cells. one cells connects , the other one doesn't.
the sandbox is opennow. the password i put in below is real. you can test it yourself.
The first cell is using GraphDabase.driver and it connects ok.
from neo4j import GraphDatabase
Neo4j connection details
NEO4J_URI = 'bolt://3.95.137.38:7687'
NEO4J_USERNAME = 'neo4j'
NEO4J_PASSWORD = 'laundries-battery-cabs'
def test_connection(uri, username, password):
try:
driver = GraphDatabase.driver(uri, auth=(username, password))
print("Driver created successfully.")
session = driver.session()
result = session.run("RETURN 'Connection Successful' AS message")
print(f"Connection successful: {result.single()['message']}")
session.close()
except Exception as e:
print(f"Connection failed: {e}")
test_connection(NEO4J_URI, NEO4J_USERNAME, NEO4J_PASSWORD)
but the other cell fails
from graphdatascience import GraphDataScience
import graphdatascience
#from neo4j import GraphDatabase
NEO4J_URI = 'neo4j+s://5618a8fbafb4015155a4e6793dc9fb18.bolt.neo4jsandbox.com:443'
NEO4J_USERNAME = 'neo4j'
NEO4J_PASSWORD = 'laundries-battery-cabs'
AURA_DS = True
try:
gds = GraphDataScience(
NEO4J_URI,
auth=(NEO4J_USERNAME, NEO4J_PASSWORD),
aura_ds=AURA_DS
)
print ("connected successfuly")
gds.set_database("neo4j") # Ensure the database exists; remove this if it's not needed.
print(f"Connected to GDS version: {gds.version()}")
except Exception as e:
print(f"Failed to connect to GDS: {e}")
the neo4j+s link i put there is the same one that i can login to neo4j browser
ip address: 3.95.137.38
htp port 7474
bolt port 7687
Bolt URL:
bolt://3.95.137.38:7687
Websocket Bolt URL:
bolt+s://5618a8fbafb4015155a4e6793dc9fb18.neo4jsandbox.com:7687
Websocket Bolt URL (Port 443):
bolt+s://5618a8fbafb4015155a4e6793dc9fb18.bolt.neo4jsandbox.com:443
it seems GraphDataScience needs neo4j+s connection . that is reason i put there but still is failing.
i appreciate your help