1
- Using Connector/C++ 8 {#usage}
2
- ===============================
1
+ Using Connector/C++ {#usage}
2
+ ============================
3
3
4
4
It is easiest to use Connector/C++ from a CMake project. For any target that
5
5
uses Connector/C++ it is enough to link that target with the `mysql::concpp`
@@ -36,7 +36,7 @@ variable to the top-level Connector/C++ install location:
36
36
37
37
@note
38
38
The `mysql-concpp` cmake module is defined starting from version 8.3.0. For
39
- earlier versions of Connector/C++ 8 one has to configure build manually setting
39
+ earlier versions of Connector/C++ one has to configure build manually setting
40
40
correct include paths, link libraries etc. See @ref manual_config
41
41
42
42
Connector/C++ implements three APIs for communicating with MySQL Server. Two
@@ -67,28 +67,18 @@ For earlier versions the following set of headers needs to be included instead:
67
67
where the exact set of headers represented by `<mysql/cppconn/*.h>` pattern
68
68
depends on the APIs used in the code.
69
69
70
- @note Legacy code writen against erlier versions of Connector/C++ might have
71
- includes of the following form (without `mysql/` prefix):
72
- ~~~~
73
- #include <mysql_driver.h>
74
- #include <mysql_connection.h>
75
- #include <cppconn/*.h>
76
- ~~~~
77
- To build such code with Connector/C++ 8 without modifying it, add
78
- `${mysql-concpp_DIR}/include/jdbc` to the include path.
79
-
80
70
81
71
### Linking with Connector/C++ dynamically
82
72
83
73
Connector targets defined by `mysql-concpp` module refer to shared connector
84
74
libraries and imply dynamic linking. Depending on the platform, the shared
85
75
Connector/C++ library is named:
86
76
87
- - `libmysqlcppconn8 .so` on Unix platforms (soname `libmysqlcppconn8 .so.B`)
88
- - `libmysqlcppconn8 .dylib` on the OSX platform (link name
89
- `libmysqlcppconn8 .B.dylib`)
90
- - `mysqlcppconn8 -B-vs14.dll` on Windows platforms
91
- (with import library vs14/mysqlcppconn8 .lib).
77
+ - `libmysqlcppconnx .so` on Unix platforms (soname `libmysqlcppconnx .so.B`)
78
+ - `libmysqlcppconnx .dylib` on the OSX platform (link name
79
+ `libmysqlcppconnx .B.dylib`)
80
+ - `mysqlcppconnx -B-vs14.dll` on Windows platforms
81
+ (with import library vs14/mysqlcppconnx .lib).
92
82
93
83
The classic API implementation is placed in a separate library which
94
84
has `libmysqlcppconn` as the base name: `libmysqlcppconn.so`,
@@ -100,7 +90,7 @@ used when building the application and when running it must match.
100
90
The `-vs14` suffix used in Windows names indicates supported Microsoft Visual
101
91
Studio toolchain version and is there to allow installing and using on the same
102
92
computer connector libraries targeted at different VS versions. Currently
103
- Connector/C++ supports VS2019 and VS2020 and they both use the same major
93
+ Connector/C++ supports VS2019 and VS2022 and they both use the same major
104
94
toolchain version 14. Therefore only `-vs14` variants of libraries are shipped
105
95
at the moment.
106
96
@@ -177,14 +167,6 @@ will set variable `MYSQL_CONCPP_DEBUG_FOUND` to true if debug libraries were
177
167
found.
178
168
179
169
180
- @note
181
- The `mysql-concpp` module always expects the release variant of the connector
182
- to be present at the install location. If using custom installation that
183
- contains only debug builds the `find_module(mysql-concpp)` command will fail
184
- with error. At this point such debug-only installation can be used only after
185
- manual setting of appropriate compiler and linker flags.
186
-
187
-
188
170
### Connector dependencies
189
171
190
172
Connector/C++ libraries depend on OpenSSL. For system-wide installations this
@@ -308,15 +290,15 @@ following:
308
290
- The `${mysql-concpp_DIR}/include` directory is added to the compiler
309
291
include path.
310
292
311
- - The connector shared library `libmysqlcppconn8 .so`
312
- (`libmysqlcppconn8 .dylib` in case of MacOS) is added to linker inputs. For
293
+ - The connector shared library `libmysqlcppconnx .so`
294
+ (`libmysqlcppconnx .dylib` in case of MacOS) is added to linker inputs. For
313
295
the library implementing the classic API the names are `libmysqlcppconn.so`
314
296
and `libmysqlcppconn.dylib`. It is best to specify full paths to these
315
297
libraries which are found at `${mysql-concpp_DIR}/lib64`.
316
298
317
299
- On Windows the linker line should refer to the import library (rather than
318
300
the DLL) that is located at `${mysql-concpp_DIR}/lib64/vs14`. The import
319
- library name is `mysqlcppconn8 .lib` (`libmysqlcppconn.lib` for the classic
301
+ library name is `mysqlcppconnx .lib` (`libmysqlcppconn.lib` for the classic
320
302
library).
321
303
322
304
We do not try to cover manual build configuration for static linking here. It
@@ -327,7 +309,7 @@ it does in your particular scenario.
327
309
328
310
329
311
<!--
330
- Copyright (c) 2015, 2020 , Oracle and/or its affiliates.
312
+ Copyright (c) 2015, 2024 , Oracle and/or its affiliates.
331
313
332
314
This program is free software; you can redistribute it and/or modify
333
315
it under the terms of the GNU General Public License, version 2.0, as
0 commit comments