Home

Awesome

<img src="https://griddb.org/brand-resources/griddb-logo/png/color.png" align="center" height="240" alt="GridDB"/>

GridDB C Client

Overview

The GridDB C Client provides a C interface for GridDB.
This repository also includes simple samples.
Please refer to C API Reference for detailed information.

Operating environment

Library building and program execution are checked in the environment below.

OS: CentOS 7.9(x64) (gcc 4.8.5), Windows 11(x64) (VS2017, CMake 3.14.5), MacOS Catalina 10.15 (clang 12.0.0)
GridDB server: V5.6 CE(Community Edition), CentOS 7.9(x64)

OS: RockyLinux 9.3(x64) (gcc 11)
GridDB server: V5.6 CE(Community Edition), RockyLinux 9.3(x64)

OS: Ubuntu 22.04(x64) (gcc 11)
GridDB server: V5.6 CE(Community Edition), Ubuntu 22.04(x64)

Quick start (CentOS, Ubuntu)

Using source code

Build

Run the make command like the following:

$ cd client/c
$ ./bootstrap.sh
$ ./configure
$ make 

and create the following file and links under the bin/ folder.

libgridstore.so
libgridstore.so.0
libgridstore.so.0.0.0

Execute a sample program

GridDB server need to be started in advance.

$ cp client/c/sample/sample1.c .
$ gcc -I./client/c/include -L./bin sample1.c -lgridstore
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./bin
$ ./a.out <GridDB notification address(default is 239.0.0.1)> <GridDB notification port(default is 31999)>
  <GridDB cluster name> <GridDB user> <GridDB password>
  -->Person: name=name02 status=false count=2 lob=[65, 66, 67, 68, 69, 70, 71, 72, 73, 74]

(Additional information)

Using RPM or DEB

Install

[CentOS, Ubuntu]

About installation information:
https://software.opensuse.org/download/package?project=home:knonomura&package=griddb-c-client

Execute a sample program

GridDB server need to be started in advance.

$ cp /usr/griddb_c_client-X.X.X/sample/sample1.c .
$ gcc sample1.c -lgridstore
$ ./a.out <GridDB notification address(default is 239.0.0.1)> <GridDB notification port(default is 31999)>
  <GridDB cluster name> <GridDB user> <GridDB password>
  -->Person: name=name02 status=false count=2 lob=[65, 66, 67, 68, 69, 70, 71, 72, 73, 74]

(Additional information)

Quick start (MacOS)

Using source code

Build

Run the make command like the following:

$ cd client/c
$ ./bootstrap.sh
$ ./configure
$ make

and create the following file and links under the bin/ folder.

libgridstore.dylib
libgridstore.0.dylib
libgridstore.0.0.0.dylib

Execute a sample program

GridDB server need to be started in advance.

$ cp client/c/sample/sample1.c .
$ gcc -I./client/c/include -L./bin sample1.c -lgridstore
$ export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:./bin
$ ./a.out <GridDB notification address(default is 239.0.0.1)> <GridDB notification port(default is 31999)>
  <GridDB cluster name> <GridDB user> <GridDB password>
  -->Person: name=name02 status=false count=2 lob=[65, 66, 67, 68, 69, 70, 71, 72, 73, 74]

(Additional information)

Quick start (Windows)

Using source code

Generate standard build files from cmake

Build with VS2017

Open <PATH_TO_OUTPUT_CMAKE>\client.sln by VS2017.

Choose build client solution to build c client.

Output at <C_CLIENT_SRC_PATH>\bin\x64\Release (build with Release mode, <C_CLIENT_SRC_PATH>\bin\x64\Debug if choose Debug mode).

gridstore_c.dll
gridstore_c.lib

Execute a sample program

GridDB server need to be started in advance.

After starting VS with <PATH_TO_OUTPUT_CMAKE>\sample.sln, build sample project.

A sample.exe is created under the <C_CLIENT_SRC_PATH>\bin\x64\Release folder (build with Release mode, <C_CLIENT_SRC_PATH>\bin\x64\Debug if choose Debug mode).

> sample.exe sample1 en <GridDB notification address(default is 239.0.0.1)> <GridDB notification port(default is 31999)>
  <GridDB cluster name> <GridDB user> <GridDB password>
  -->Person: name=name02 status=false count=2 lob=[65, 66, 67, 68, 69, 70, 71, 72, 73, 74]

(Additional information)

Using MSI

Install

Install the MSI package (https://github.com/griddb/c_client/releases), the package is extracted into C:/Program Files/GridDB/GridDB C Client/X.X.X folder.

How to create and build a sample program

Explains how to compile a program. The following is the procedure for VS2017.

Execute a sample program

GridDB server need to be started in advance.

After building VS sample project, build the project and run sample.exe.

> sample.exe <GridDB notification address(default is 239.0.0.1)> <GridDB notification port(default is 31999)>
  <GridDB cluster name> <GridDB user> <GridDB password>
  -->Person: name=name02 status=false count=2 lob=[65, 66, 67, 68, 69, 70, 71, 72, 73, 74]

Document

Refer to the file below for more detailed information.

Note: GEOMETRY type is not available for C Client CE(Community Edition).

Community

License

The C client source license is Apache License, version 2.0.
See 3rd_party/3rd_party.md for the source and license of the third party.