简体   繁体   中英

Connect neo4j server through java neo4j api using ip address

I am using java neo4j api for connecting to neo4j and perform operation on it using.

GraphDatabaseFactory gdf=new GraphDatabaseFactory();
GraphDatabaseService gds = gdf.newEmbeddedDatabase(new File(" path for neo4j databases /graph.db"));

I am able to do all kind of operation but now i want to connect through IP address ie instead of filepath i want to connect neo4j on different network but i am unable to see any option regarding this.

Every search reult shows use of graphdatabase and driver for connecting to network but for that exection query format is changed ie i have to write in cypher language. But I have already written a code which is working fine in my system using GraphDatabaseService object and org.neo4j.graphdb ie neo4j java rest api.

Any how can I connect to ip address through GraphDatabaseService. If no then how can i connect such that in the end, i get GraphDatabaseService object as I have written complete code for my project and there is no time to change it.

I have already hosted neo4j server on another network and enabled all the listening port.

With GraphDatabaseFactory you can only create an embedded database. Because it's an embedded mode, you have access to the JAVA API of Neo4j, but this one can only used on the server side ... not remotely.

If you want to connect to a remote database, you should use the java bolt driver, and so to rewrite your query in Cypher (it's the good way to do now).

If you have some use-cases that really need the Neo4j Java API (like the traversal API), you can create a Cypher procedures, and call it in a cypher query.

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