4

was wondering if I can use the Neo4j Java API for connecting to remote DBs or is REST the only way for me to access a remote DB ? Was looking to use something like

GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(NEO_4J_REMOTE_DB_ENDPOINT);

If I can use, what would my endpoint look like ? '/db/data ?

Or is it the case where I have to use REST ?

I have my server running in GAE and have a Neo4j instance in Heroku.

Thanks guys.

Prasad Khode
  • 6,602
  • 11
  • 44
  • 59
sharath
  • 3,501
  • 9
  • 47
  • 72

1 Answers1

6

REST is the only communication protocol with the server version at the moment. There have been talks about a binary protocol but that does not exist atm.

However, there are several layers for different languages over this REST API. For Java, you can find it here :

https://github.com/neo4j/java-rest-binding

This allows you to use the same API as the embedded version, but in the background it is translated to REST. There are some limitations on the functionality, and it's not up to date with all the latest versions but never the less, it works pretty darn good and I always use it with Heroku.

EDIT: If you're using maven, add this repository http://m2.neo4j.org/index.html and then add these lines to your POM

<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-rest-graphdb</artifactId>
    <version>2.0.1</version>
</dependency>
user3672265
  • 105
  • 5
Pieter-Jan
  • 1,675
  • 2
  • 19
  • 25