问题
I have installed ArangoDB 3.1 RC3 community edition and created maven project with below code
ArangoDB arangoDB = new ArangoDB.Builder().host("127.0.0.1").port(8529).build();
String dbName = "mydb";
try {
arangoDB.createDatabase(dbName);
System.out.println("Database created: " + dbName);
} catch (ArangoDBException e) {
System.err.println("Failed to create database: " + dbName + "; " + e.getMessage());
}
Here is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mydb</groupId>
<artifactId>ArangodbTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ArangodbTest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>arangodb-java-driver</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
</project>
Database is not created in ArangoDB and no exceptions are thrown, its keep on running..
I have tried with arangodb-java-driver 4.0.0 and 4.1.0 as well, but still not working
Help me to solve this issue
Thanks in advance
回答1:
With ArangoDB 3.1-RC1 to 3.1-RC3, you have to start the server with an extra endpoint for VelocyStream communication, e.g.
--server.endpoint vpp+tcp://127.0.0.1:8529.
The same for ssl:
--server.endpoint vpp+ssl://127.0.0.1:8530
If you also want to use the web interface, you need an endpoint only with tcp. You can use both endpoints (one with vpp, one without). You only need two differnt ports. Then you can use both the driver and the web inertface, e.g.
--server.endpoint vpp+tcp://127.0.0.1:8529 --server.endpoint tcp://127.0.0.1:8530
With the ArangoDB final version 3.1, you need the driver in version 4.1.0, because we changed the velocystream protocol in this version, to remove the need of an extra velocystream endpoint.
Driver version 4.1.0 only works with the final release - which we release at the moment - and not with the RCs. 3.1 should be available in the next 1-2 days.
回答2:
I think you lost some code. Try this :
ArangoDB arango = new ArangoDB.Builder().host("127.0.0.1").port(8529).user("root").password("yourpass").build();
来源:https://stackoverflow.com/questions/40355244/arangodb-java-api-create-database-not-working-in-3-1-rc3