MySQL Connector/C++ 8.0 Developer Guide  /  Introduction to Connector/C++

Chapter 1 Introduction to Connector/C++

MySQL Connector/C++ 8.0 is a MySQL database connector for C++ applications that connect to MySQL servers. Connector/C++ can be used to access MySQL servers that implement a document store, or in a traditional way using SQL statements. The preferred development environment for Connector/C++ 8.0 is to enable development of C++ applications using X DevAPI, or plain C applications using X DevAPI for C, but Connector/C++ 8.0 also enables development of C++ applications that use the legacy JDBC-based API from Connector/C++ 1.1.

Connector/C++ applications that use X DevAPI or X DevAPI for C require a MySQL server that has X Plugin enabled. Connector/C++ applications that use the legacy JDBC-based API neither require nor support X Plugin.

For more detailed requirements about required MySQL versions for Connector/C++ applications, see Platform Support and Prerequisites.

For notes detailing the changes in each release of Connector/C++, see MySQL Connector/C++ Release Notes.

Connector/C++ Benefits

MySQL Connector/C++ offers the following benefits for C++ users compared to the MySQL C API provided by the MySQL client library:

  • Convenience of pure C++.

  • Support for these application programming interfaces:

    • X DevAPI

    • X DevAPI for C

    • Legacy JDBC 4.0-based API

  • Support for the object-oriented programming paradigm.

  • Reduced development time.

  • Licensed under the GPL with the FLOSS License Exception.

  • Available under a commercial license upon request.

X DevAPI and X DevAPI for C

Connector/C++ implements X DevAPI, which enables connecting to MySQL servers that implement a document store with X Plugin. X DevAPI also enables applications to execute SQL statements.

Connector/C++ also implements a similar interface called X DevAPI for C for use by applications written in plain C.

For general information about X DevAPI, see X DevAPI User Guide. For reference information specific to the Connector/C++ implementation of X DevAPI and X DevAPI for C, see MySQL Connector/C++ X DevAPI Reference in the X DevAPI section of MySQL Documentation.

Legacy JDBC API and JDBC Compatibility

Connector/C++ implements the JDBC 4.0 API, if built to include the legacy JDBC connector:

The Connector/C++ JDBC API is compatible with the JDBC 4.0 API. Connector/C++ does not implement the entire JDBC 4.0 API, but does feature these classes: Connection, DatabaseMetaData, Driver, PreparedStatement, ResultSet, ResultSetMetaData, Savepoint, Statement.

The JDBC 4.0 API defines approximately 450 methods for the classes just mentioned. Connector/C++ implements approximately 80% of these.

Note

The legacy JDBC connector in Connector/C++ 8.0 is based on the connector provided by Connector/C++ 1.1. For more information about using the JDBC API in Connector/C++ 8.0, see MySQL Connector/C++ 1.1 Developer Guide.

Platform Support and Prerequisites

To see which platforms are supported, visit the Connector/C++ downloads page.

On Windows platforms, Commercial and Community Connector/C++ distributions require the Visual C++ Redistributable for Visual Studio. The Redistributable is available at the Microsoft Download Center; install it before installing Connector/C++. The acceptable Redistributable versions depend on your Connector/C++ version:

  • Connector/C++ 8.0.19 and higher: VC++ Redistributable 2017 or higher.

  • Connector/C++ 8.0.14 to 8.0.18: VC++ Redistributable 2015 or higher.

The following requirements apply to building and running Connector/C++ applications, and to building Connector/C++ itself if you build it from source:

  • To run Connector/C++ applications, the MySQL server requirements depend on the API the application uses:

    • Connector/C++ applications that use X DevAPI or X DevAPI for C require a server from MySQL 8.0 (8.0.11 or higher) or MySQL 5.7 (5.7.12 or higher), with X Plugin enabled. For MySQL 8.0, X Plugin is enabled by default. For MySQL 5.7, X Plugin must be enabled explicitly. (Some X Protocol features may not work with MySQL 5.7.)

    • Applications that use the JDBC API can use a server from MySQL 5.5 or higher. X Plugin is neither required nor supported.

  • To build Connector/C++ applications:

    • The MySQL version does not apply.

    • On Windows, Microsoft Visual Studio is required. The acceptable MSVC versions depend on your Connector/C++ version and the type of linking you use:

      • Connector/C++ 8.0.19 and higher: Connector/C++ binary distributions are compatible with projects built using MSVC 2019 (using either dynamic or static connector libraries) or MSVC 2017 (using dynamic connector libraries).

      • Connector/C++ 8.0.14 to 8.0.18: MSVC 2017 or 2015.

      • Connector/C++ prior to 8.0.14: MSVC 2015.

  • To build Connector/C++ from source:

    • The MySQL C API client library may be required:

      • For Connector/C++ built without the JDBC connector (which is the default), the client library is not needed.

      • To build Connector/C++ with the JDBC connector, configure Connector/C++ with the WITH_JDBC CMake option enabled. In this case, the JDBC connector requires a client library from MySQL 8.0 (8.0.11 or higher) or MySQL 5.7 (5.7.9 or higher).

    • On Windows, Microsoft Visual Studio is required. The acceptable MSVC versions depend on your Connector/C++ version:

      • Connector/C++ 8.0.19 and higher: MSVC 2019 or 2017.

      • Connector/C++ 8.0.14 to 8.0.18: MSVC 2017 or 2015.

      • Connector/C++ prior to 8.0.14: MSVC 2015.