The new ArangoDB Java Driver
A new arangodb-java-driver is out now, it’s on github. The driver is available for ArangoDB from version 2.2 onwards.
How to include the driver in your application ?
The driver is available as maven artifact. To add the driver to your project with maven, add the following code to your pom.xml:
<dependencies> <dependency> <groupId>com.arangodb</groupId> <artifactId>arangodb-java-driver</artifactId> <version>2.2</version> </dependency> .... </dependencies>
So you included the driver to your application, how can you use it? First of all you have to configure the driver. You can either import a properties file or use the configuration object. We will focus on the most important properties:
First we create an instance of the configuration object ..
ArangoConfigure configure = new ArangoConfigure();
Lets say we have an ArangoDB instance running under
http://123.456.789.10:8529 and we want to configure the driver to talk to that database. Furthermore we expect that a database “testDatabase” exists and want to use it as the default database:
configure.setHost("123.456.789.10"); configure.setPort(8529); configure.setDefaultDatabase("testDatabase");
Alternatively you can create a properties file and import it to the configuration object:
port=8529 host=123.456.789.10 defaultDatabase=testDatabase
Import the file:
Now we can use this configuration to instantiate the driver:
ArangoDriver driver = new ArangoDriver(configure);
Now you can use the ArangoDriver class to communicate with your ArangoDB.
Get the latest tutorials, blog posts and news: