Tip
If you already have a Druid instance running, skip the steps to set up Druid.
-
Start a Druid 37 nano-quickstart instance:
docker run --detach --rm \ --name druid \ --platform linux/amd64 \ --publish 8888:8888 \ --volume "$PWD/start-druid.sh:/opt/druid/start-druid.sh:ro" \ --entrypoint /bin/bash \ apache/druid:37.0.0 /opt/druid/start-druid.sh -
Wait for Druid to accept SQL queries:
until curl --fail --silent --output /dev/null \ --header 'Content-Type: application/json' \ --data '{"query":"SELECT 1"}' \ http://localhost:8888/druid/v2/sql; do sleep 2; done
-
Install the Druid ADBC driver:
dbc install --level user --pre druid
-
Customize the C++ program
main.cppas needed,- Change the connection arguments in the
AdbcDatabaseSetOption()calls- Format the URI according to the driver documentation, or keep it as is
- Change the connection arguments in the
-
Build and run the C++ program:
Using Make:
pixi run make ./druid_demo
Or using CMake:
pixi run cmake -B build pixi run cmake --build build ./build/druid_demo
-
Clean build artifacts:
Using Make:
pixi run make clean
Using CMake:
rm -rf build
-
Stop the Docker container running Druid:
docker stop druid