Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Connecting C++ and SingleStore with ADBC

Instructions

Tip

If you already have a SingleStore instance running, skip the steps to set up and clean up SingleStore.

Prerequisites

  1. Install Pixi

  2. Install dbc

Set up SingleStore

  1. Install Docker

  2. Start a SingleStore instance:

    docker run \
        -d --rm --name singlestoredb-dev \
        -e ROOT_PASSWORD="YOUR_ROOT_PASSWORD" \
        -p 3306:3306 -p 8080:8080 -p 9000:9000 \
        ghcr.io/singlestore-labs/singlestoredb-dev:latest

Important

To run the container on Apple Silicon, add the --platform linux/amd64 option.

Connect to SingleStore

  1. Install the SingleStore ADBC driver:

    dbc install --level user --pre singlestore
  2. Customize the C++ program main.cpp

    • Change the connection arguments in the AdbcDatabaseSetOption() calls
    • If you changed which database you're connecting to, also change the SQL SELECT statement in AdbcStatementSetSqlQuery()
  3. Build and run the C++ program:

    Using Make:

    pixi run make
    ./singlestore_demo

    Or using CMake:

    pixi run cmake -B build
    pixi run cmake --build build
    ./build/singlestore_demo

Clean up

  1. Stop the Docker container running SingleStore:

    docker stop singlestoredb-dev
  2. Clean build artifacts:

    Using Make:

    pixi run make clean

    Using CMake:

    rm -rf build