Jia Weiぃも
Jia Weiぃも

Reputation: 17

understanding ways to use cypher query in embedded neo4j app

As far as I know there are 3 ways to run cypher query in with embedded java app.

  1. org.neo4j.driver.Session session = GraphDatabase.driver(uri, AuthTokens.basic(user, password)).session().run(query) src,chatgpt
  1. new GraphDatabaseFactory().newEmbeddedDatabase(STORE_DIR).execute(query) src,Neo4j slow cypher query in embedded mode
  1. try (Transaction tx = graphDb.beginTx()) then org.neo4j.graphdb.Result result=tx.execute(query); src,written by myself based on existing api,https://github.com/neo4j/neo4j/blob/5.6/community/graphdb-api/src/main/java/org/neo4j/graphdb/Transaction.java

So the main question is


I believe some SO members might frown with 2 questions*.However I believed that the context is very important and it will clearly show my attempts and what I currently understood as.

Upvotes: 0

Views: 140

Answers (1)

cybersam
cybersam

Reputation: 67019

You would use the neo4j Java API with an embedded neo4j DB, not the Java Driver API (which is only for accessing un-embedded DBs).

The correct way to use Cypher with an embedded DB is documented here.

Upvotes: 1

Related Questions