Skip to main content
Version: 3.12

Run Non-Transactional Storage Operations Through the SQL Interface

This guide explains how to run non-transactional storage operations through the SQL interface for ScalarDB Cluster.

warning

You need to have a license key (trial license or commercial license) for ScalarDB Cluster. If you don't have a license key, please contact us.

Preparation

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

note

ScalarDB Cluster in standalone mode is primarily for development and testing purposes.

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-cluster-standalone-mode

Set up a database

Select your database, and follow the instructions to configure it for ScalarDB Cluster.

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

Run MySQL locally

You can run MySQL in Docker Compose by using the docker-compose.yaml file in the scalardb-samples/scalardb-cluster-standalone-mode directory.

To start MySQL, run the following command:

docker compose up -d mysql

Configure ScalarDB Cluster

The scalardb-cluster-node.properties file in the scalardb-samples/scalardb-cluster-standalone-mode directory contains database configurations for ScalarDB Cluster. Please uncomment the properties for MySQL in the scalardb-cluster-node.properties file so that the configuration looks as follows:

# For MySQL
scalar.db.storage=jdbc
scalar.db.contact_points=jdbc:mysql://mysql-1:3306/
scalar.db.username=root
scalar.db.password=mysql

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

Set up ScalarDB Cluster in standalone mode

To set up ScalarDB Cluster in standalone mode, you'll need to configure ScalarDB Cluster to run non-transactional storage operations, set a license key, and then start ScalarDB Cluster.

Configure ScalarDB Cluster 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 scalardb-cluster-node.properties:

scalar.db.transaction_manager=single-crud-operation

Set the license key

Set the license key (trial license or commercial license) for the ScalarDB Clusters in the properties file. For details, see How to Configure a Product License Key.

Start ScalarDB Cluster in standalone mode

To start ScalarDB Cluster in standalone mode, run the following command:

note

If you want to change other configurations for ScalarDB Cluster, update the scalardb-cluster-node.properties file before running the command below.

docker compose up -d scalardb-cluster-node

Create or import a schema

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

Also, for a list of supported DDLs, see ScalarDB SQL Grammar.

Create your application

Configure your JDBC application

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

Add the ScalarDB JDBC driver to your project

You can add the ScalarDB JDBC driver 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 the ScalarDB JDBC driver to your application.

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

dependencies {
implementation 'com.scalar-labs:scalardb-sql-jdbc:3.12.4'
implementation 'com.scalar-labs:scalardb-cluster-java-client-sdk:3.12.4'
}

Configure the ScalarDB Cluster Java SDK for the SQL interface

For details about configuring the ScalarDB Cluster Java SDK for the SQL interface, see ScalarDB Cluster SQL client configurations.

Use the JDBC API

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

note

The following limitations apply to non-transactional storage operations:

  • Beginning a transaction is not supported.
  • Executing multiple mutations in a single SQL statement is not supported.
  • The isolation level is always READ_COMMITTED.

Learn more