Pure C examples for the IoTDB Session C API (SessionC.h): tree model (tree_example) and table model (table_example). Default connection: 127.0.0.1:6667, user root / password root (edit the macros at the top of each .c file).
Using Maven to build this example project (requires Boost, same as the C++ client; on Windows see iotdb-client/client-cpp/README.md):
cdthe root path of the whole project- run
mvn package -DskipTests -P with-cpp -pl example/client-c-example -am
(usemvn clean package ...when no other process holds files underiotdb-client/client-cpp/target; on Windows add Boost paths, e.g.
-D"boost.include.dir=C:\local\boost_1_87_0" -D"boost.library.dir=C:\local\boost_1_87_0\lib64-msvc-14.2") cd example/client-c-example/target
After a successful build you should have:
- Unpacked C++ client headers and libraries under
client/and Thrift underthrift/(same layout as client-cpp-example) - CMake-generated binaries, for example on Windows MSVC:
Release/tree_example.exe,Release/table_example.exe
(exact path depends on the CMake generator)
Start IoTDB first, then:
# Windows (example)
Release\tree_example.exe
Release\table_example.exe
On failure, the programs print to stderr and you can inspect ts_get_last_error().
example/client-c-example/
+-- README.md
+-- pom.xml
+-- src/
| +-- CMakeLists.txt
| +-- tree_example.c
| +-- table_example.c
The Maven build copies src/*.c and src/CMakeLists.txt into target/ next to the unpacked client/ and thrift/ trees, then runs CMake to compile the two executables.