Skip to main content
Version: 3.18

Run Non-Transactional Storage Operations Through the Core Library

This guide explains how to run non-transactional storage operations through the ScalarDB Core library.

Preparation​

For the purpose of this guide, you will set up a database and ScalarDB by using a sample in the ScalarDB samples repository.

Clone the ScalarDB samples repository​

Open Terminal, then clone the ScalarDB samples repository by running the following command:

git clone https://github.com/scalar-labs/scalardb-samples

Then, go to the directory that contains the necessary files by running the following command:

cd scalardb-samples/scalardb-sample

Set up a database​

Follow the instructions below to configure your database for ScalarDB.

For a list of databases that ScalarDB supports, see Databases.

Select your relational database.

Run Db2 locally

You can run IBM Db2 in Docker Compose by using the docker-compose.yml file in the scalardb-samples/scalardb-sample directory.

To start IBM Db2, run the following command:

docker compose up -d db2

Configure ScalarDB

The database.properties file in the scalardb-samples/scalardb-sample directory contains database configurations. Please uncomment the properties for Db2 in the database.properties file so that the configuration looks as follows:

# For Db2
scalar.db.storage=jdbc
scalar.db.contact_points=jdbc:db2://localhost:50000/sample
scalar.db.username=db2inst1
scalar.db.password=db2inst1

For a comprehensive list of configurations for ScalarDB, see ScalarDB Configurations.

Configure ScalarDB to run non-transactional storage operations​

To run non-transactional storage operations, you need to configure the scalar.db.transaction_manager property to single-crud-operation in the configuration file database.properties:

scalar.db.transaction_manager=single-crud-operation

Create or import a schema​

ScalarDB has its own data model and schema that maps to the implementation-specific data model and schema.

Load initial data as necessary​

ScalarDB Data Loader is a utility for importing and exporting data with ScalarDB.

Create your Java application​

This section describes how to add the ScalarDB Core library to your project and how to configure it to run non-transactional storage operations by using Java.

Add ScalarDB to your project​

The ScalarDB library is available on the Maven Central Repository. You can add the library as a build dependency to your application by using Gradle or Maven.

Select your build tool, and follow the instructions to add the build dependency for ScalarDB to your application.

To add the build dependency for ScalarDB by using Gradle, add the following to build.gradle in your application:

dependencies {
implementation 'com.scalar-labs:scalardb:3.18.0'
}

Use the Java API​

For details about the Java API, see ScalarDB Java API Guide.

note

The following limitations apply to non-transactional storage operations:

Learn more​