Skip to content

Commit 69e57d6

Browse files
committed
8.0.7 documentation update.
1 parent 2291b1e commit 69e57d6

File tree

3 files changed

+267
-262
lines changed

3 files changed

+267
-262
lines changed

doc/building.txt

Lines changed: 79 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@ To build Connector/C++, the following tools and libraries are required:
1111

1212
- CMake 2.8.12 or later.
1313

14+
- Boost 1.59 or later if the version of the C++ standard library used does
15+
not implement the UTF8 converter (`codecvt_utf8`). Boost is also required
16+
when building the legacy connector (see below).
17+
1418
- OpenSSL version 1.0.x if connector is built with OpenSSL.
1519

16-
@note: On some platforms Boost libraries are needed to build the connector.
17-
Boost version 1.59.
20+
- MySQL 8.0 client library if building the legacy connector (see below).
21+
1822

1923
Build configuration
2024
-------------------
@@ -25,54 +29,30 @@ Only out-of-source builds are supported. To configure a build, execute
2529
$ cmake <Connector/C++ source location>
2630
~~~~~~~
2731

28-
If Boost libraries are used and `cmake` can not find the required Boost
29-
version, or if it is installed in a non-standard location, specify the
32+
If Boost libraries are required and `cmake` can not find them, specify the
3033
correct location using the option:
3134

3235
- `-DWITH_BOOST=<Boost location>`
3336

34-
To specify the installation location (see below), use the option:
35-
36-
- `-DCMAKE_INSTALL_PREFIX=<Install location>`
37-
38-
If not specified, the install location defaults to
39-
`/usr/local/mysql/connector-c++-8.0`
40-
(`<User home>/MySQL/"MySQL Connector C++ 8.0"` on Windows).
41-
4237
By default a shared library is built. To build a static library, use the option:
4338

4439
- `-DBUILD_STATIC=yes`
4540

46-
Building of the legacy C++ JDBC4 library
47-
----------------------------------------
48-
Connector/C++ supports the legacy C++ JDBC4 API, which is placed inside a
49-
separate library `libmysqlcppconn` or `mysqlcppconn` depending on the Operating
50-
System.
41+
The build system generated by `cmake` has install target which, by default, installs to `/usr/local/mysql/connector-c++-8.0`
42+
(`<User home>/MySQL/"MySQL Connector C++ 8.0"` on Windows). To change this default install location use the option:
5143

52-
In order to enable building of the legacy C++ JDBC4 library the Connector/C++
53-
needs to be built with the following options:
54-
55-
- `WITH_JDBC` to enable the legacy C++ JDBC4 API. Usage of this option in cmake
56-
command looks like this: `-DWITH_JDBC=yes`. By default this option is not
57-
enabled and the legacty C++ JDBC4 functionality is not built.
58-
59-
- `MYSQL_DIR` to allow using server libraries such as libmysqlclient if it is
60-
not installed at the default location.
61-
The command line should look like: `-DMYSQL_DIR=<path_to_mysql_server_dir>`
62-
63-
- `WITH_BOOST` to point to boost location if it is different from the default.
64-
The command line should look like: `-DMYSQL_DIR=<path_to_mysql_server_dir>`
44+
- `-DCMAKE_INSTALL_PREFIX=<Install location>`
6545

6646

6747
Configuring SSL libraries
6848
-------------------------
6949
Connector/C++ can be built with different SSL libraries.
70-
Use `-DWITH_SSL=<Option value>' to specify the desired SSL build type:
50+
Use `-DWITH_SSL=<Option value>` to specify the desired SSL build type:
7151

72-
- bundled - build with bundled YaSSL code
73-
- system - build with external openSSL library installed on the system, the
52+
- `bundled` - build with bundled YaSSL code (the default)
53+
- `system` - build with external openSSL library installed on the system, the
7454
library location is detected by cmake.
75-
- <path> - build with external openSSL library installed at specified
55+
- `<path>` - build with external openSSL library installed at specified
7656
location.
7757

7858
@note when Connector/C++ is configured to be built to use OpenSSL it will make
@@ -83,6 +63,7 @@ Use `-DWITH_SSL=<Option value>' to specify the desired SSL build type:
8363
it means adding -lssl -lcrypto to the compile/link command.
8464
In Windows this is handled automatically.
8565

66+
8667
Building and testing
8768
--------------------
8869
A build can be started with the following cmake invocation in the build
@@ -106,16 +87,10 @@ the Connector/C++ shared library:
10687

10788
- `libmysqlcppconn8.so.1` on Unix
10889
- `libmysqlcppconn8.1.dylib` on OS X
109-
- `CCC/mysqlcppconn8-vsXX.dll` on Windows, where `-vs12` or `-vs14` prefix
90+
- `CCC/mysqlcppconn8-1-vsXX.dll` on Windows, where `-vs12` or `-vs14` prefix
11091
depends on the MSVC version used to build the connector
111-
112-
If Connector/C++ is built to support the legacy C++ JDBC4 API (WITH_JDBC option
113-
enabled) the build library directory will have another shared library:
11492

115-
- `libmysqlcppconn.so.7` on Unix
116-
- `libmysqlcppconn.7.dylib` on OS X
117-
- `CCC/mysqlcppconn-7-vsXX.dll` on Windows, where `-vs12` or `-vs14` prefix
118-
depends on the MSVC version used to build the connector
93+
The number 1 in the library name is the major ABI version of the library. It is part of the library name so that different versions of the library can be used at the same time on a single system.
11994

12095
On Unix and OS X also appropriate symbolic links are created. On Windows the
12196
import library for the DLL is created at `CCC/mysqlcppconn8.lib` (the `CCC/`
@@ -124,15 +99,8 @@ subdirectory is named the same as the build configuration used).
12499
In the case of a static library build, the output library names are:
125100

126101
- `libmysqlcppconn8-static.a` on Unix and OS X
127-
- `CCC/mysqlcppconn8-static.lib` and `CCC/mysqlcppconn8-static-mt.lib`
128-
on Windows
129-
130-
If Connector/C++ is built to support the legacy C++ JDBC4 API (WITH_JDBC option
131-
enabled) the build library directory will have another static library:
132-
133-
- `libmysqlcppconn-static.a` on Unix and OS X
134-
- `CCC/mysqlcppconn-static.lib` and `CCC/mysqlcppconn-static-mt.lib`
135-
on Windows
102+
- `CCC/mysqlcppconn8-static.lib` or `CCC/mysqlcppconn8-static-mt.lib`
103+
on Windows (see [Windows Notes] (@ref win_notes)).
136104

137105
### Testing
138106

@@ -165,8 +133,8 @@ $ cmake -DWITH_CONCPP=<Connector/C++ install location> <source location>/testapp
165133
$ cmake --build . --config CCC
166134
~~~~~~~
167135

168-
This should create the `devapi_test`, `xapi_test` and `jdbc_test` executables
169-
in the `run/` subdirectory of the build location.
136+
This should create the `devapi_test` and `xapi_test` executables
137+
in the `run/` subdirectory of the build location. If testing static connector, pass `-DBUILD_STATIC=ON` option when configuring test applications.
170138

171139
@note
172140
On Windows, if the connector was built with the static runtime by specifying
@@ -177,9 +145,6 @@ in the `run/` subdirectory of the build location.
177145
The 32/64-bit Windows `cmake` generator (`"Visual Studio 14 2015 Win64"` vs
178146
`"Visual Studio 14 2015"`) used to build test applications must match
179147
the one used to build the connector.
180-
181-
@note in order to build `jdbc_test` the Connector/C++ has to be built
182-
with WITH_JDBC, MYSQL_DIR and WITH_BOOST options.
183148

184149
Before running test programs, ensure that a MySQL Server instance is running
185150
with X Plugin loaded into it. The easiest way of arranging this is to use
@@ -190,36 +155,27 @@ the `mysql-test-run.pl` script from the MySQL Server distribution. In the
190155
$ perl mysql-test-run.pl --start-and-exit --mysqld=--plugin-load=mysqlx
191156
~~~~~~~
192157

193-
This should start a test server instance with X plugin loaded into it. This can
194-
be confirmed by looking at messages output by the server to the `mysqld.1.err`
195-
file found in `mysql-test/var/log/` subdirectory. The log file should contain
196-
a note from the X plugin informing about it being ready to serve connections:
197-
198-
~~~~~~~
199-
Plugin mysqlx reported: 'X plugin tcp connection enable at port 13009.'
200-
~~~~~~~
201-
202-
When started like this, the plugin will listen on port 13009 instead of
158+
This should start a test server instance with X plugin loaded into it. When
159+
started like this, the plugin will listen on port 13009 instead of
203160
the standard 33060 one.
204161

205-
Now one can start one of the test programs and see the output similar to the
206-
one presented below. The `devapi_test` program accepts port number as the first
207-
argument, with the default value 33060. Thus, if the server was started
208-
as described above, run the test program with the following URL as a parameter:
162+
Now you can run one of the test programs and see the output similar to the
163+
one presented below. Test programs accept a connection string as an argument.
164+
If the server was started as described above, run the test program with the following connection string as a parameter:
209165

210166
~~~~~~~
211167
$ run/devapi_test mysqlx://[email protected]:13009
168+
$ run/xapi_test mysqlx://[email protected]:13009
212169
~~~~~~~
213170

214-
The program uses the `root` user account without any password and assumes
171+
This invocation uses the `root` user account without any password and assumes
215172
that there is a `test` schema in the server (these assumptions hold for
216-
a server started using `mysql-test-run.pl`). Different user credentials can
217-
be passed as the second and the third argument of `devapi_test` invocation.
173+
a server started using `mysql-test-run.pl`).
218174

219175
If everything goes well, `devapi_test` should produce output similar to this:
220176

221177
~~~~~~~
222-
Creating session on localhost, port 13009 ...
178+
Creating session on mysqlx://[email protected]:13009 ...
223179
Session accepted, creating collection...
224180
Inserting documents...
225181
- added doc with id: AA71B4BF6B72E511BD76001E684A06F0
@@ -253,31 +209,69 @@ doc#1: {"_id": "A0ABC08DAABAD1110C120800273BD115", "age": 2, "name": "bar", "toy
253209
Done!
254210
~~~~~~~
255211

256-
For the `xapi_test` program, connection details can be given in form of an URL,
257-
as shown below:
258212

259-
~~~~~~~
260-
$ run/xapi_test mysqlx://[email protected]:13009
261-
~~~~~~~
213+
Building legacy C++ JDBC4 library @anchor build_jdbc
214+
---------------------------------
215+
216+
Apart from the new APIs introduced in version 8.0 of the connector (X DevAPI
217+
and XAPI), Connector/C++ also supports the legacy API based on JDBC4. This
218+
legacy API is implemented as a separate library with base name `mysqlcppconn`
219+
as opposed to `mysqlcppconn8` library implementing the new APIs.
220+
221+
To build the legacy library pass `-DWITH_JDBC=ON` option during cmake
222+
configuration step (this option is disabled by default). This brings additional
223+
build dependencies that must be satisfied:
224+
225+
- The MySQL 8.0 client library is needed. If `cmake` can not find it at default
226+
locations, pass `-DMYSQL_DIR=<path_to_mysql_server_dir>` option.
227+
228+
- Boost libraries are always required in this case. As explained above, use
229+
`WITH_BOOST` option if `cmake` can not find Boost at default locations.
230+
231+
@note
232+
The code implementing legacy connector is inside `jdbc/` subdirectory of the
233+
source tree. If sources are obtained from a git repository this sub-directory
234+
must be fetched separately as a git sub-module. Invoke
235+
`git submodule update --init` to populate contents of `jdbc/` subdirectory.
262236

263-
For the `jdbc_test` program the command line would look as this:
237+
If everything goes well, after building the connector the build location
238+
should contain additional legacy connector library:
239+
240+
- `libmysqlcppconn.so.7` on Unix
241+
- `libmysqlcppconn.7.dylib` on OS X
242+
- `CCC/mysqlcppconn-7-vsXX.dll` on Windows
243+
244+
If building static libraries, the static legacy library has name:
245+
246+
- `libmysqlcppconn-static.a` on Unix and OS X
247+
- `CCC/mysqlcppconn-static.lib` or `CCC/mysqlcppconn-static-mt.lib`
248+
on Windows
249+
250+
251+
It is possible to build additional test application `jdbc_test` for testing
252+
the legacy connector library. To do this, pass `-DWITH_JDBC=ON` cmake option
253+
when configuring the build of test applications. Also, `MYSQL_DIR`
254+
and `WITH_BOOST` must be set of cmake can not find required dependencies.
255+
256+
The connection string accepted as argument of `jdbc_test` application must be
257+
in the form expected by JDBC API. The user name is passed as the 2nd argument.
258+
For example:
264259

265260
~~~~~~~
266261
$ run/jdbc_test tcp://127.0.0.1:13009 root
267262
~~~~~~~
268263

269264

270-
Windows Notes
265+
Windows Notes @anchor win_notes
271266
-------------
272267
Connector/C++ uses C++11 language and for that reason it is not possible
273268
to build it with Microsoft Visual Studio 2010 or earlier.
274269

275270
On Windows one can request that Connector/C++ uses the static runtime library
276-
(The `/MT*` compiler option) by setting the cmake option
277-
`-DSTATIC_MSVCRT=yes`
278-
271+
(The `/MT*` compiler option) by setting the cmake option `-DSTATIC_MSVCRT=yes`.
279272
This might be necessary if code which uses Connector/C++ also uses the static
280-
runtime.
273+
runtime. If building static library in this mode, the `-mt` suffix will
274+
be added to its name to distinguish it from a library built in `/MD` mode.
281275

282276
Selecting a cmake generator such as `"Visual Studio 14 2015 Win64"` vs
283277
`"Visual Studio 14 2015"` selects the 64 or 32 bit platform for which

doc/index.txt

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,38 @@
11
MySQL Connector/C++ Documentation {#mainpage}
22
=================================
33

4-
MySQL Connector/C++ is a library for applications written in C or C++ that want
5-
to communicate with MySQL database servers. Version 8.0 of Connector/C++
4+
MySQL Connector/C++ is a library for applications written in C or C++ that
5+
communicate with MySQL database servers. Version 8.0 of Connector/C++
66
implements three different APIs which can be used by applications...
77

88
- The new [X DevAPI] (@ref devapi) for applications written in C++.
99
- The new [XAPI] (@ref xapi) for applications written in plain C.
10-
- The [legacy JDBC based API]
11-
(https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-reference.html),
10+
- The [legacy JDBC4 based API] (@ref jdbc_ref)
1211
also implemented in version 1.1 of the connector.
1312

1413
The new APIs give access to MySQL implementing a [document store]
15-
(https://dev.mysql.com/doc/refman/8.0/en/document-store.html). Consequently,
16-
code written against these APIs can work only with a MySQL Server with the
17-
X Plugin enabled in it. This is supported by MySQL Server version 8 or 5.7.12+.
18-
Apart from accessing the document store, the new APIs allow executing
19-
traditional SQL queries as well.
14+
(https://dev.mysql.com/doc/refman/8.0/en/document-store.html). Internally
15+
these APIs use the new X Protocol to communicate with the MySQL Server.
16+
Consequently, code written against these APIs can work only with MySQL Server 8
17+
with the X Plugin enabled in it. Apart from accessing the document store, the
18+
new APIs allow executing traditional SQL queries as well.
2019

21-
Application written against the JDBC based API of Connector/C++ 1.1 can be also
20+
Applications written against the JDBC4 based API of Connector/C++ 1.1 can be also
2221
compiled with Connector/C++ 8.0 which is backward compatible with the earlier
2322
version. Such code does not require the X Plugin and can communicate with older
24-
version of the MySQL Server.
23+
versions of the MySQL Server using the legacy protocol.
2524

2625
The API to be used is chosen by including appropriate set of headers, as
2726
explained in @ref usage.
28-
27+
2928
More information:
3029

3130
- [Connector/C++ X DevAPI Reference] (@ref devapi_ref)
3231
- [Connector/C++ XAPI Reference] (@ref xapi_ref)
33-
- [Connector/C++ legacy C++ API based on JDBC4 Reference] (@ref jdbc_ref)
3432
- [How to build code that uses Connector/C++](@ref usage)
3533
- [Building Connector/C++] (@ref building)
3634
- [Indexing Document Collections] (@ref indexing)
3735

38-
@note
39-
Code that uses Connector/C++ 8.0 can communicate only with MySQL Server version
40-
5.7 with X Plugin loaded into it.
4136

4237
<!--
4338
Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.

0 commit comments

Comments
 (0)