Application Development with MariaDB Connector/C

MariaDB Connector/C enables C and C++ applications to establish client connections to MariaDB Enterprise over TLS.

Build Your Application with Connector/C

When you build a C application, your compiler must link your application with the MariaDB Connector/C shared library.

The following gcc (GNU GCC) command demonstrates how to link an application with the MariaDB Connector/C shared library using the mariadb_config utility to determine the compiler arguments:

$ gcc -o example example.c $(mariadb_config --include --libs)

If you are not using the gcc compiler, please consult your compiler's manual.

Header Files

MariaDB Connector/C includes several header files. In some cases, developers might find it useful to inspect the MariaDB Connector/C header files to view the definitions of structures, functions, and constants.

The header files:

  • Contain the definitions of structures, functions, and constants.

  • Are installed to the /usr/include/mariadb/ directory by default on Linux.

C applications developed using MariaDB Connector/C must include the mysql.h header file.