在Neo4j的客户端-服务器设置中使用Java API的方法是什么?
我是不是错过了某种Java连接器?到目前为止,我只找到了REST api:http://neo4j.com/docs/stable/server-java-rest-client-example.html,但我不知道如何使用像这样的对象:
org.neo4j.graphdb.GraphDatabaseService;
org.neo4j.graphdb.Label;
org.neo4j.graphdb.Node;
org.neo4j.graphdb.Transaction;
org.neo4j.graphdb.factory.GraphDatabaseFactory;
org.neo4j.graphdb.factory.GraphDatabaseSettings;
org.neo4j.graphdb.schema.ConstraintDefinition;
org.neo4j.graphdb.schema.ConstraintType; 过度休息。我希望避免构建繁琐的URL和解析字符串响应。我想将我的应用程序从嵌入式迁移到客户机-服务器,但到目前为止似乎还不可能。
发布于 2015-02-23 00:04:58
实际上,有一个用于Neo4j的JDBC连接器,请查看:
http://neo4j.com/developer/java/#_using_neo4j_server_with_jdbc
和:
https://github.com/neo4j-contrib/neo4j-jdbc#minimum-viable-snippet
// Make sure Neo4j Driver is registered
Class.forName("org.neo4j.jdbc.Driver");
// Connect
Connection con = DriverManager.getConnection("jdbc:neo4j://localhost:7474/");
// Querying
try(Statement stmt = con.createStatement())
{
ResultSet rs = stmt.executeQuery("MATCH (n:User) RETURN n.name");
while(rs.next())
{
System.out.println(rs.getString("n.name"));
}
}发布于 2015-02-23 09:40:58
我认为FrobberOfBits的回答是正确的。没有用于客户端-服务器的Java API。
https://stackoverflow.com/questions/28650968
复制相似问题