简体   繁体   中英

How to connect Gremlin to Neo4j database step by step?

I'm new in Gremlin. And I want to connect Gremlin to Neo4j Database and I already tried the way to connect to Neo4j database.

gremlin> g = new neo4jgraph[EmbeddedGraphDatabase[C:\Users\Olivia Stella\Documents\Neo4j\default.graphdb]]

and before it's connected to Gremlin, an error message shown up:

java.util.prefs.WindowsPreferences <init> Warning: Could not open/create prefs root node Software\JavaSoft\prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

Note:

-Gremlin 2.4.0

-Java SDK 7

-Neo4j 2.0.1

That doesn't look like valid Gremlin syntax from the REPL:

gremlin> g = new Neo4jGraph('/tmp/neo4j')
==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
gremlin> g.addVertex([name:'stephen'])
==>v[0]
gremlin> g.V.map
==>{name=stephen}
gremlin> g.commit()
==>null
gremlin> g.shutdown()
==>null
gremlin> g = new Neo4jGraph('/tmp/neo4j')
==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
gremlin> g.V.map                         
==>{name=stephen}

Alternatively, if you have an existing org.neo4j.graphdb.GraphDatabaseService instance that you would like to use you can pass that into the Neo4jGraph constructor instead of the path to where the db files are (or where you would like them to be).

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