Run Transactions Through ScalarDB Cluster SQL
This guide explains how to configure your ScalarDB properties file and creating schemas to run transactions through a one-phase or a two-phase commit interface by using ScalarDB Cluster SQL.
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.
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.
- MySQL
- PostgreSQL
- Oracle Database
- SQL Server
- DynamoDB
- Cosmos DB for NoSQL
- Cassandra
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
Run PostgreSQL locally
You can run PostgreSQL in Docker Compose by using the docker-compose.yaml
file in the scalardb-samples/scalardb-cluster-standalone-mode
directory.
To start PostgreSQL, run the following command:
docker compose up -d postgres
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 PostgreSQL in the scalardb-cluster-node.properties file so that the configuration looks as follows:
# For PostgreSQL
scalar.db.storage=jdbc
scalar.db.contact_points=jdbc:postgresql://postgres-1:5432/
scalar.db.username=postgres
scalar.db.password=postgres
Run Oracle Database locally
You can run Oracle Database in Docker Compose by using the docker-compose.yaml
file in the scalardb-samples/scalardb-cluster-standalone-mode
directory.
To start Oracle Database, run the following command:
docker compose up -d oracle
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 Oracle Database in the scalardb-cluster-node.properties file so that the configuration looks as follows:
# For Oracle
scalar.db.storage=jdbc
scalar.db.contact_points=jdbc:oracle:thin:@//oracle-1:1521/FREEPDB1
scalar.db.username=SYSTEM
scalar.db.password=Oracle
Run SQL Server locally
You can run SQL Server in Docker Compose by using the docker-compose.yaml
file in the scalardb-samples/scalardb-cluster-standalone-mode
directory.
To start SQL Server, run the following command:
docker compose up -d sqlserver