Keep these general considerations in mind for building Connector/C++ applications:
It is important that the tools you use to build your Connector/C++ applications are compatible with the tools used to build Connector/C++ itself. Ideally, build your applications with the same tools that were used to build the Connector/C++ binaries.
To avoid issues, ensure that these factors are the same for your applications and Connector/C++ itself:
Runtime linker configuration settings.
To avoid potential crashes, the build configuration of Connector/C++ should match the build configuration of the application using it. For example, do not use the release build of Connector/C++ with a debug build of the client application.
To use a different compiler version, release configuration, or runtime library, first build Connector/C++ from source using your desired settings (see Chapter 4, Installing Connector/C++ from Source), then build your applications using those same settings.
Connector/C++ binary distributions include an
INFO_BIN file that describes the
environment and configuration options used to build the
distribution. If you installed Connector/C++ from a binary distribution
and experience build-related issues on a platform, it may help
to check the settings that were used to build the distribution
on that platform. Binary distributions also include an
INFO_SRC file that provides information
about the product version and the source repository from which
the distribution was produced. (Prior to Connector/C++ 8.0.14, look for
BUILDINFO.txt rather than
X DevAPI uses C++11 language features. For that reason,
enable C++11 support in the compiler using the
-std=c++11 option when building Connector/C++
applications that use X DevAPI. This option is not needed
for applications that use X DevAPI for C (which is a plain C
API) or the legacy JDBC API (which is based on plain C++),
unless the application code uses C++11.
To compile applications that use Connector/C++, the Boost header files are needed if you use the legacy JDBC API.
Prior to Connector/C++ 8.0.15, for applications that use X DevAPI
or X DevAPI for C, the Boost header files are needed on Unix
and Unix-like platforms if you build using
gcc and the version of the C++ standard
library on your system does not implement the UTF8 converter
If the Boost header files are needed, Boost 1.59.0 or newer must be installed, and the location of the headers must be added to the include path. To obtain Boost and its installation instructions, visit the official Boost site.
When Connector/C++ is built using OpenSSL, it makes the connector library dependent on OpenSSL dynamic libraries:
When linking an application to Connector/C++ dynamically, this dependency is relevant only at runtime.
When linking an application to Connector/C++ statically, the OpenSSL libraries should be linked as well. On Linux, this means adding
-lssl -lcryptoexplicitly to the compile/link command. On Windows, this is handled automatically.
On Windows, link to the dynamic version of the C++ Runtime Library.
X DevAPI for C applications need
at runtime. Depending on your platform or build tools, a
different library may apply. For example, the library is
libc++ on macOS; see
If an application is built using dynamic link libraries, those libraries must be present not just on the build host, but on target hosts where the application runs. The libraries and their runtime dependencies must be found by the dynamic linker. The dynamic linker must be properly configured to find Connector/C++ libraries and their dependencies.
Connector/C++ libraries built by Oracle depend on the OpenSSL libraries. The latter must be installed on the system in order to run code that links against Connector/C++ libraries. Another option is to put the OpenSSL libraries in the same location as Connector/C++ In this case the dynamic linker should find them next to the connector library. See also macOS Notes, and Windows Notes.
It is possible to build Connector/C++ with an SSL library other than
OpenSSL. Use the
CMake option to specify which SSL library to
Section 4.4, “Connector/C++ Source-Configuration Options”).
For applications linked against Connector/C++ libraries that are not
built using OpenSSL, the OpenSSL libraries are not required at
On Windows, target hosts running the client application must have the Visual C++ Redistributable for Visual Studio installed. The required version is VC++ Redistributable 2017 or 2015. (VC++ Redistributable 2015 prior to Connector/C++ 8.0.14.)
On Solaris, target hosts running the client application must have the runtime libraries from Developer Studio 12.6 installed.