使用官网提供的python驱动模块无法用bolt方式链接数据库
发布于 5 年前 作者 zpf4934 2334 次浏览 来自 问答

from neo4j import GraphDatabase uri = "bolt://localhost:7687" driver = GraphDatabase.driver(uri,auth=(“neo4j”,“password”)) 用户名和密码均正确,但是提示出现OSError错误 但是使用py2neo模块却可以正常链接 from py2neo import Graph test_graph = Graph( “bolt://localhost:7687”, username=“neo4j”, password=“password” ) 下面是错误提示,有哪位大神遇到过这种情况吗? linux环境,neo4j-4.0.3

====================================================== OSError Traceback (most recent call last) <ipython-input-72-4e9e6dade713> in <module> 1 uri = “bolt://localhost:7687” ----> 2 driver = GraphDatabase.driver(uri,auth=(“neo4j”,“password”))

~/anaconda3/envs/spark/lib/python3.7/site-packages/neo4j/init.py in driver(cls, uri, **config) 118 :class:.Driver subclass instance directly. 119 “”" –> 120 return Driver(uri, **config) 121 122

~/anaconda3/envs/spark/lib/python3.7/site-packages/neo4j/init.py in new(cls, uri, **config) 159 for subclass in Driver.subclasses(): 160 if parsed_scheme in subclass.uri_schemes: –> 161 return subclass(uri, **config) 162 raise ValueError(“URI scheme %r not supported” % parsed.scheme) 163

~/anaconda3/envs/spark/lib/python3.7/site-packages/neo4j/init.py in new(cls, uri, **config) 233 234 pool = ConnectionPool(connector, instance.address, **config) –> 235 pool.release(pool.acquire()) 236 instance._pool = pool 237 instance._max_retry_time = config.get(“max_retry_time”, default_config[“max_retry_time”])

~/anaconda3/envs/spark/lib/python3.7/site-packages/neobolt/direct.py in acquire(self, access_mode) 713 714 def acquire(self, access_mode=None): –> 715 return self.acquire_direct(self.address) 716 717

~/anaconda3/envs/spark/lib/python3.7/site-packages/neobolt/direct.py in acquire_direct(self, address) 606 if can_create_new_connection: 607 try: –> 608 connection = self.connector(address, error_handler=self.connection_error_handler) 609 except ServiceUnavailable: 610 self.remove(address)

~/anaconda3/envs/spark/lib/python3.7/site-packages/neo4j/init.py in connector(address, **kwargs) 230 231 def connector(address, **kwargs): –> 232 return connect(address, **dict(config, **kwargs)) 233 234 pool = ConnectionPool(connector, instance.address, **config)

~/anaconda3/envs/spark/lib/python3.7/site-packages/neobolt/direct.py in connect(address, **config) 970 raise ServiceUnavailable(“Failed to resolve addresses for %s” % address) 971 else: –> 972 raise last_error

~/anaconda3/envs/spark/lib/python3.7/site-packages/neobolt/direct.py in connect(address, **config) 961 host = address[0] 962 s = _connect(resolved_address, **config) –> 963 s, der_encoded_server_certificate = _secure(s, host, security_plan.ssl_context, **config) 964 connection = _handshake(s, address, der_encoded_server_certificate, **config) 965 except Exception as error:

~/anaconda3/envs/spark/lib/python3.7/site-packages/neobolt/direct.py in _secure(s, host, ssl_context, **config) 852 log_debug("[#%04X] C: <SECURE> %s", local_port, host) 853 try: –> 854 s = ssl_context.wrap_socket(s, server_hostname=host if HAS_SNI and host else None) 855 except SSLError as cause: 856 s.close()

~/anaconda3/envs/spark/lib/python3.7/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session) 421 server_hostname=server_hostname, 422 context=self, –> 423 session=session 424 ) 425

~/anaconda3/envs/spark/lib/python3.7/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session) 868 # non-blocking 869 raise ValueError(“do_handshake_on_connect should not be specified for non-blocking sockets”) –> 870 self.do_handshake() 871 except (OSError, ValueError): 872 self.close()

~/anaconda3/envs/spark/lib/python3.7/ssl.py in do_handshake(self, block) 1137 if timeout == 0.0 and block: 1138 self.settimeout(None) -> 1139 self._sslobj.do_handshake() 1140 finally: 1141 self.settimeout(timeout)

OSError: [Errno 0] Error

回到顶部