简体   繁体   中英

Neo4j client-server API

What is the way to use Java API in client-server setup of Neo4j?

Do I miss some kind of Java connector ? Only thing I found so far was REST api: http://neo4j.com/docs/stable/server-java-rest-client-example.html , but I have no idea how to use objects like:

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;    

over REST. I want to avoid constructing cumbersome URLs and parse string responses. I want to migrate from my application from embedded to client-server, but so far it seems to impossible.

Actually there is a JDBC connector for Neo4j, check out:

http://neo4j.com/developer/java/#_using_neo4j_server_with_jdbc

And:

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"));
    }
}

I think FrobberOfBits answered this one right. Theres no Java API for client-server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM