我无法使用neo4j-python-driver版本5.3.0连接到Neo4j。要求是使用Neo4j python驱动程序使用密码查询来查询NEO4J DB。即使数据库已启动并正在运行,它也会出现连接到服务器失败的错误,我可以通过NEO4J Desktop登录和使用。
neo4j.exceptions.ServiceUnavailable: Couldn't connect to <URI>:7687 (resolved to ()):
[SSLCertVerificationError] Connection Failed. Please ensure that your database is listening on the correct host and port and that you have enabled encryption if required. Note that the default encryption setting has changed in Neo4j 4.0. See the docs for more information. Failed to establish encrypted connection. (code 1: Operation not permitted)
注意:URI隐藏在上述错误中。
我已将例外添加到“忽略证书验证问题”,但它无法解决此问题。
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
感谢您帮助解决此问题。
我通过下面的代码片段连接
from neo4j import GraphDatabase
import urllib3
#Ignores certificate verification issue
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Initialize connection to database
driver = GraphDatabase.driver('bolt+s://<URI>:7687', auth=(',username', '<password'))
query = 'match (n:Event{name:"test"}) return n'
#Run Cypher query
with driver.session() as session:
info = session.run(query)
for item in info:
print(item)
1条答案
按热度按时间bjp0bcyl1#
无法了解您的连接方式,但我们可以: