Hello. I am new to neo4j. I want to use java-driver-1.0.6
I am added jar files to my java project and started neo4j 2.0.0. when I ran this code:
import org.neo4j.driver.v1.*;
public class Main {
public static void main(String[] args) {
Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic( "neo4j", "neo4j" ) );
Session session = driver.session();
session.run( "CREATE (a:Person {name:'Arthur', title:'King'})" );
StatementResult result = session.run( "MATCH (a:Person) WHERE
a.name = 'Arthur' RETURN
a.name AS name, a.title AS title" );
while ( result.hasNext() )
{
Record record = result.next();
System.out.println( record.get( "title" ).asString() + " " + record.get("name").asString() );
}
session.close();
driver.close();
}
}
I got this error:
Exception in thread "main" org.neo4j.driver.v1.exceptions.ClientException: Unable to connect to 'localhost' on port 7687, ensure the database is running and that there is a working network connection to it.
at org.neo4j.driver.internal.connector.socket.SocketClient.start(SocketClient.java:82)
at org.neo4j.driver.internal.connector.socket.SocketConnection.<init>(SocketConnection.java:64)
at org.neo4j.driver.internal.connector.socket.SocketConnector.connect(SocketConnector.java:52)
at org.neo4j.driver.internal.pool.InternalConnectionPool.acquire(InternalConnectionPool.java:113)
at org.neo4j.driver.internal.InternalDriver.session(InternalDriver.java:53)
at Main.main(Main.java:6)