2016-06-08 3 views
1

Ich verwende ein Beispielskript, um eine Verbindung zum neo4j-Server herzustellen und danach eine Abfrage auszuführen. Aber ich bin immer diese Fehlermeldung:Neo4j kann keine Verbindung zum Graphdatenbankserver herstellen

C:\cygwin\lib\python2.7\site-packages\neo4j\v1\session.py:94: UserWarning: Bolt over TLS is only available in Python 2.7.9+ and Python 3.3+ so communications are not secure

warn("Bolt over TLS is only available in Python 2.7.9+ and Python 3.3+ "

Traceback (most recent call last): File "C:\Users\FTS.fts-gnosis\workspace\hello1\tester.py", line 3, in session = driver.session() File "C:\cygwin\lib\python2.7\site-packages\neo4j\v1\session.py", line 148, in session session = Session(self) File "C:\cygwin\lib\python2.7\site-packages\neo4j\v1\session.py", line 461, in init self.connection = connect(driver.host, driver.port, driver.ssl_context, **driver.config) File "C:\cygwin\lib\python2.7\site-packages\neo4j\v1\connection.py", line 384, in connect s = create_connection((host, port)) File "C:\Python27\lib\socket.py", line 553, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM):

socket.gaierror: [Errno 11004] getaddrinfo failed

Beispielcode:

from neo4j.v1 import GraphDatabase, basic_auth 
driver = GraphDatabase.driver("bolt://http://localhost:7474",    auth=basic_auth("neo4j", "neo")) 
session = driver.session() 
result = session.run("MATCH (label:OFFICER)-[r]->() WHERE label.NAME = 'Prinza Limited' RETURN label,r") 
print result 
session.close() 

Antwort

4

Der Fahrer nur Bolt unterstützen, so dass keine http möglich.

Ihre Verbindung uri mischt die beiden Protokolle, Änderung dieser:

driver = GraphDatabase.driver("bolt://localhost",auth=basic_auth("neo4j", "neo")) 
session = driver.session() 

Normalerweise nur durch das Beispiel im Repository readme folgenden, sollten Sie die http nicht in der Verbindung uri: https://github.com/neo4j/neo4j-python-driver#example-usage

+0

Dummer Fehler. Entschuldigung für das Problem –

+0

@ZohairZahid Wenn dies Ihr Problem gelöst hat, akzeptieren Sie bitte die Antwort –

+0

, wie man die Antwort akzeptiert, ich bin neu hier. –