0

I have a neo4j database ready and I want to make a java app for retrieving data from it. How can I load this already made database in my program and then query it? In the code I'm giving below I want to initialize the db object with that database.

thanks in advance

ExecutionEngine engine = new ExecutionEngine(db); String query = ""; ExecutionResult result = engine.execute( query);

1 Answer 1

1

See the Tutorial in the Neo4j Manual:

http://docs.neo4j.org/chunked/stable/tutorials-cypher-java.html

GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase( DB_PATH );
ExecutionEngine engine = new ExecutionEngine( db );
ExecutionResult result = engine.execute( "start n=node(*) where n.name! = 'my node' return n, n.name" );

Make sure to keep the db and execution engine in a shared variable. And to shutdown() the db when your program ends.

Sign up to request clarification or add additional context in comments.

1 Comment

I had forgottent to stop the server and tha database was locked.So that's why I had problems with the initiliazation as it is in the neo4j manual. Thank you very much for your answer. You are doing great work with the neo4j tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.