1
- +-------------------------------------------------------------+
2
- | Connector/ODBC |
3
- | UNIX Platforms |
4
- +-------------------------------------------------------------+
1
+ You can find information about building MySQL ODBC Driver for
2
+ Linux/Unix systems at:
5
3
6
- INTRODUCTION
7
- ---------------------------------------------------------------
8
-
9
- In this document, we provide a general and brief explaination
10
- of how to build the MyODBC driver on UNIX platforms.
11
-
12
- NOTE: This information is fairly generic. You may find other
13
- README files with more detailed information about building
14
- MyODBC with specific flavours of UNIX.
15
-
16
- WHAT YOU NEED
17
- ---------------------------------------------------------------
18
-
19
- UNIX
20
- ----
21
-
22
- UNIX or a UNIX-like operating system such as;
23
-
24
- - Solaris
25
- - Linux
26
- - OSX
27
-
28
- ODBC
29
- ----
30
-
31
- You need an ODBC SDK, and you probably want an ODBC Driver
32
- Manager.
33
-
34
- ODBC has not, traditionally, been a standard part of any UNIX
35
- or UNIX-like platform. This causes a number of vendors to
36
- provide ODBC solutions which can be added to UNIX. In theory
37
- this should not be a problem, but in practice this can cause
38
- compatability and portability issues.
39
-
40
- Recently; Linux distributions have been including unixODBC as a
41
- standard option, and Apple OSX now has ODBC by default.
42
-
43
- We recommend, and use, unixODBC on all UNIX-like platforms
44
- except OSX where we use the default ODBC.
45
-
46
- See:
47
- http://www.unixodbc.org/
48
-
49
- Compiler Tools
50
- --------------
51
-
52
- We try to build using the native compiler tool set for the
53
- target platform. For example, this is SunStudio on Solaris. But
54
- the GNU tool-chain is a common compiler that works across all
55
- platforms.
56
-
57
- Source Code
58
- -----------
59
-
60
- You can get the source code from the git source repository (for
61
- 'bleeding edge' code) or more commonly, simply download the zip
62
- or tarball of the source.
63
-
64
- Source:
65
- git clone https://github.com/mysql/mysql-connector-odbc.git <local_dir>
66
- https://github.com/mysql/mysql-connector-odbc
67
-
68
- Downloads:
69
- http://dev.mysql.com/downloads/connector/odbc/
70
-
71
- BUILD
72
- ---------------------------------------------------------------
73
-
74
- cmake
75
- -------------
76
-
77
- CMake is the build system used to create configure files for your
78
- system. Instructions are as follows:
79
-
80
- cd into the MyODBC source directory, then run cmake. For example:
81
-
82
- $ cd /path/to/myodbc/source
83
- $ cmake -G "Unix Makefiles" .
84
-
85
- CMake will look for iODBC by default. Alternatively, if you are using
86
- unixODBC instead of iODBC, then you'll need to pass in the appropriate
87
- parameter, such as:
88
-
89
- $ cmake -G "Unix Makefiles" -DWITH_UNIXODBC=1
90
-
91
- If the driver manager headers and/or libraries cannot be found, then you
92
- may specify their location by passing in these additional parameters:
93
-
94
- -DODBC_INCLUDES=/path/to/headers
95
- -DODBC_LIB_DIR=/path/to/libs
96
-
97
- Some driver managers such as iODBC might keep the ODBCINST headers and
98
- libraries in a separate directory. To address this possibility there
99
- are two more parameters:
100
-
101
- -DODBCINST_INCLUDES=/path/to/odbcinst_headers
102
- -DODBCINST_LIB_DIR=/path/to/odbcinst_library
103
-
104
- And you might need to help cmake find the MySQL headers and libraries,
105
- by setting the environment variable or additional parameters
106
- MYSQL_INCLUDE_DIR, MYSQL_LIB_DIR or MYSQL_DIR to the appropriate location.
107
- For example:
108
-
109
- $ export MYSQL_INCLUDE_DIR=/usr/local/mysql/include
110
- $ export MYSQL_LIB_DIR=/usr/local/mysql/lib
111
- $ export MYSQL_DIR=/usr/local/mysql
112
-
113
- Mysql client library(libmysqlclient.a) is build statically with
114
- MyODBC. If you want to build dynamically or want to specify mysql client
115
- library name with which MyODBC should get linked, use MYSQLCLIENT_LIB_NAME
116
- additional parameter with mysqlclient library name.
117
-
118
- -DMYSQLCLIENT_LIB_NAME=mysqlclient lib name with extension
119
-
120
- In MyODBC, mysql_config is used to find MYSQL_INCLUDE_DIR, MYSQL_LIB_DIR,
121
- MYSQL_LINK_FLAGS and MYSQL_CXXFLAGS each of which can be overriden if they
122
- are provided as additional parameters in cmake. mysql_config location can
123
- be specified using MYSQL_CONFIG_EXECUTABLE additional parameter.
124
-
125
- -DMYSQL_CONFIG_EXECUTABLE=/path/to/mysql_config
126
- -DMYSQL_LINK_FLAGS=mysql link flags
127
- -DMYSQL_CXXFLAGS=mysql C++ linkage flags
128
-
129
- If you want to enable C++ linkage to mysql client library, then specify
130
- MYSQL_CXX_LINKAGE to true. By default, MYSQL_CXX_LINKAGE is enabled for
131
- mysql version greater then equal to 5.6.4
132
- -DMYSQL_CXX_LINKAGE=1
133
-
134
- Upon success, CMake will create the appropriate make files. Then,
135
- execute make:
136
-
137
- $ make
138
-
139
- INSTALL
140
- ---------------------------------------------------------------
141
-
142
- You probably want to be the root user, or use sudo, because installation
143
- will probably require these extra privileges. To install the MyODBC
144
- library and tools, execute one of the following:
145
-
146
- $ sudo make install
147
- # make install
148
-
149
- That will copy all of the MyODBC files to their appropriate locations.
150
-
151
- Next, you probably want to register the driver with the ODBC on your
152
- system. See your ODBC documentation for more about how to do this.
153
-
154
- For unixODBC, you could run ODBCConfig from a GUI as root, or use the
155
- odbcinst command line tool. You may also want to look at the
156
- myodbc-installer command-line tool for this.
4
+ https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation-source-unix.html
0 commit comments