我有一个neo4j数据库设置,我已经通过浏览器登录并正确设置了密码:
以下 python 代码WORKS:
>>> from neo4j.v1 import GraphDatabase, basic_auth
>>> driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "pass"))
但是,当我尝试使用 Java (org.neo4j.driver:neo4j-java-driver:1.4.4)进行连接时:
Driver driver = GraphDatabase.driver( "bolt://localhost:7687", AuthTokens.basic("neo4j", "pass") );
我得到了一个持续拒绝的连接:
org.neo4j.driver.v1.exceptions.ServiceUnavailableException: Unable to connect to localhost:7687, ensure the database is running and that there is a working network connection to it.
...
Caused by: java.net.ConnectException: Connection refused
这导致相信存在某种身份验证问题(密码错误?)但是,由于我通过Python成功连接,因此显然不是这样。