NebulaGraph Java¶
NebulaGraph Java is a Java client for connecting to and managing the NebulaGraph database.
Prerequisites¶
JDK 8 is installed.
Compatibility with NebulaGraph¶
See github.
Download NebulaGraph Java¶
-
(Recommended) To install a specific version of NebulaGraph Java, use the Git option
--branch
to specify the branch. For example, to install v3.8.0, run the following command:$ git clone --branch release-3.8 https://github.com/vesoft-inc/nebula-java.git
-
To install the daily development version, run the following command to download the source code from the
master
branch:$ git clone https://github.com/vesoft-inc/nebula-java.git
Use NebulaGraph Java¶
Note
We recommend that each thread use one session. If multiple threads use the same session, the performance will be reduced.
When importing a Maven project with tools such as IDEA, set the following dependency in pom.xml
.
Note
3.0.0-SNAPSHOT
indicates the daily development version that may have unknown issues. We recommend that you replace 3.0.0-SNAPSHOT
with a released version number to use a table version.
<dependency>
<groupId>com.vesoft</groupId>
<artifactId>client</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
If you cannot download the dependency for the daily development version, set the following content in pom.xml
. Released versions have no such issue.
<repositories>
<repository>
<id>snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
If there is no Maven to manage the project, manually download the JAR file to install NebulaGraph Java.
API reference¶
Click here to check the classes and functions provided by the Java Client.
Core of the example code¶
The NebulaGraph Java client provides both Connection Pool and Session Pool modes, using Connection Pool requires the user to manage session instances.
-
Session Pool
For all the code, see GraphSessionPoolExample.
-
Connection Pool
For all the code, see GraphClientExample.