Skip to content

ydb-platform/ydb-java-sdk

Repository files navigation

License Maven metadata URL Build CI Codecov

The Java SDK for YDB enables Java developers to work with YDB.

Getting Started

Connection setup

Before you begin, you need to create a database and setup authorization. Please see the Prerequisites section of the connection guide in documentation for information on how to do that.

Minimum requirements

To use YDB Java SDK you will need Java 1.8+.

Install the SDK

The recommended way to use the YDB Java SDK in your project is to consume it from Maven. Firstly you can import YDB Java BOM to specify correct versions of SDK modules.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>tech.ydb</groupId>
            <artifactId>ydb-sdk-bom</artifactId>
            <version>2.3.7</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

After that you can specify the SDK modules that your project needs in the dependencies:

<dependencies>
    <!-- Scheme service client -->
    <dependency>
        <groupId>tech.ydb</groupId>
        <artifactId>ydb-sdk-scheme</artifactId>
    </dependency>

    <!-- Table service client -->
    <dependency>
        <groupId>tech.ydb</groupId>
        <artifactId>ydb-sdk-table</artifactId>
    </dependency>

    <!-- Query service client -->
    <dependency>
        <groupId>tech.ydb</groupId>
        <artifactId>ydb-sdk-query</artifactId>
    </dependency>

    <!-- Topic service client -->
    <dependency>
        <groupId>tech.ydb</groupId>
        <artifactId>ydb-sdk-topic</artifactId>
    </dependency>

    <!-- Coordination service client -->
    <dependency>
        <groupId>tech.ydb</groupId>
        <artifactId>ydb-sdk-coordination</artifactId>
    </dependency>
</dependencies>

Examples

Using Maven

In basic example folder there is simple example application that uses YDB Java SDK from Maven. See the Connect to a database section of the documentation for an instruction on how to setup and launch it.

Generic examples

In examples folder you can find more example applications with YDB Java SDK usage.

How to build

To build the YDB Java SDK artifacts locally, see Building YDB Java SDK.