Source: https://dev-docs.nebula-graph.io/v5.3.2/clients/java-client/ Documentation version: v5.3.2 # Java SDK guide This topic introduces how to set up the [Java SDK](https://github.com/vesoft-inc/nebula-java/tree/v5.3.1) to connect to NebulaGraph Database Developer Edition and perform simple queries. ## Prerequisites - JDK 8 is installed. - A NebulaGraph Database Developer Edition service group is running. For more information, see [Getting started with NebulaGraph Database Developer Edition](https://dev-docs.nebula-graph.io/v5.3.2/get-started/deploy/). ## Steps 1. Import the Java SDK into your Java project. For example, to import with Maven, add the following dependency to the `pom.xml` file: ```` com.vesoft driver 5.3.1 ```` Note: After you reference the NebulaGraph Database Developer Edition SDK dependency in a project and package it as a JAR file, if you encounter the exception `java.lang.IllegalArgumentException: Address types of NameResolver 'unix' for '192.168.15.8:9669' not supported by transport` when running this JAR file, add the plugin `maven-shade-plugin` to your project's `pom.xml` file and configure the transformer as follows: ```` org.apache.maven.plugins maven-shade-plugin 3.4.1 *:* package shade ```` 2. Select either of the following methods to connect to NebulaGraph Database Developer Edition and execute queries: Note For on-premises users, apart from specifying the username and password when connecting to NebulaGraph Database Developer Edition, you can also enable the sessionless mode, which allows you to not provide authentication information. For more information, see [Sessionless mode](https://dev-docs.nebula-graph.io/v5.3.2/server-admin/authentication/sessionless/). - If only one client needs to interact with NebulaGraph Database Developer Edition, you can use the client to establish a direct connection and execute queries. ```` NebulaClient client = null; try { client = NebulaClient.builder(":", "", "") .withAuthOptions(Collections.emptyMap()) .withConnectTimeoutMills(1000) .withRequestTimeoutMills(3000) .build(); client.execute("USE nba MATCH (v:player) RETURN v.id, v.name, v.score, v.gender, v.rate"); } catch (Exception e) { throw e; } finally { if (client != null) { client.close(); } } ```` - If multiple clients need to interact with NebulaGraph Database Developer Edition simultaneously, you can create a connection pool to manage a set of connections. You can use the pool to get a client and return it after queries are executed. ```` NebulaPool pool = null; try { pool = NebulaPool .builder(":", "", "") .withMaxClientSize(10) .withMinClientSize(1) .withConnectTimeoutMills(1000) .withRequestTimeoutMills(30000) .withBlockWhenExhausted(true) .withMaxWaitMills(Long.MAX_VALUE) .build(); NebulaClient client = pool.getClient(); client.execute("USE nba MATCH (v:player) RETURN v.id, v.name, v.score, v.gender, v.rate"); pool.returnClient(client); } catch (Exception e) { throw e; } finally { if (pool != null) { pool.close(); } } ```` Replace ``, ``, ``, and `` with the actual NebulaGraph Database Developer Edition connection information. ## More information - [Java SDK GitHub repository](https://github.com/vesoft-inc/nebula-java/tree/v5.3.1) - [Java SDK API reference](https://vesoft-inc.github.io/nebula-java/5.3.1/annotated.html)