2
votes

I am a newbie to neo4j serve. I started working on neo4j server through direct cypher queries on neo4j local server queries of creating node, label, node properties, relationship between nodes etc.. I have little bit ideas on how are things working.

Problem that I am facing is that I have stucked in connecting with neo4j server using java.

Codes I am currently trying to use to connect with local server are:-

GraphDatabaseService db = new RestGraphDatabase("http://localhost:7474/db/data");

RestGraphDatabase graphDb = new RestGraphDatabase("http://localhost:7474/db/data");

But every time I get the error 500 Server Error The call failed on the server; see server log for details

Unable to find out the reason. I am perfectly connected to my local server.But still problem remains the same.

I have succeeded in connecting with server and doing basic operation using rest api. But Still finding difficult for searching in it.That is why wanted help in using the neo4j jar files for the functionality of neo4j graph db.

Links I am following:-RestApi

Embedded graphDb

RestServer

2
Did you provide auth/credentials?Michael Hunger
No I havent provided the auth credentials as I have already turned it to false for authentication in config fileVartika

2 Answers

0
votes

I recommend to check out the JDBC driver.

See http://neo4j.com/developer/java

0
votes

You need to add the jar file that helps you in connecting with neo4j server. You can find the driver/jar file from https://github.com/larusba/doc2graph/releases/tag/v1.0.0

After downloading the file add it to your project using project preferences. Then, go using the below code to starting working on it!

Connection con = DriverManager.getConnection("jdbc:neo4j:bolt://localhost");

    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"));
        }
    }
    con.close();