Skip to main content

Getting Started

Installation​

<!-- https://mvnrepository.com/artifact/com.tigrisdata/tigris-client -->
<dependency>
<groupId>com.tigrisdata</groupId>
<artifactId>tigris-client</artifactId>
<version>insert_client_version_here</version>
</dependency>

Further instructions are available here for additional build tools.

import com.tigrisdata.db.client.*;
import com.tigrisdata.db.annotation.*;
import com.tigrisdata.db.type.*;

Client​

The Tigris Java client libraries offer both asynchronous and synchronous clients.

The asynchronous client provides non-blocking, asynchronous APIs for interacting with Tigris. These APIs let you use the SDK to build scalable applications that use system resources in an efficient way.

While the synchronous clients cater to a wider audience, and also make the client libraries approachable for users not familiar with asynchronous programming.

tip

We recommend using the asynchronous clients for production systems to maximize the use of system resources.

Create Connection​

Tigris URL, ClientID and ClientSecret need to be set as follows, in order to connect to the hosted platform:

TigrisConfiguration configuration = TigrisConfiguration.newBuilder(
"api.preview.tigrisdata.cloud",
"<your-tigris-project-name>"
).withAuthConfig(new TigrisConfiguration.AuthConfig("paste client_id here", "paste client_secret here"))
.build();
// client
TigrisClient client = StandardTigrisClient.getInstance(tigrisConfiguration);

Create Project​

Use Tigris web-console or CLI to create a Tigris project. Creation of project will create the database automatically.

Retrieve database​

Once the project is created. It automatically creates the database. You can retrieve the database instance.

TigrisDatabase db = client.getDatabase();

Create collection​

Create a collection mapping to User.class. Read more about declaring class models for Tigris collection.

CreateOrUpdateCollectionsResponse response = db.createOrUpdateCollections(User.class);

Retrieve collection​

Retrieve a collection instance.

TigrisCollection<User> collection = db.getCollection(User.class);