Documentation Home
MySQL Connector/ODBC Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 1.1Mb
PDF (A4) - 1.1Mb
EPUB - 1.0Mb
HTML Download (TGZ) - 0.9Mb
HTML Download (Zip) - 1.0Mb


MySQL Connector/ODBC Developer Guide  /  Connector/ODBC Installation  /  Building Connector/ODBC from a Source Distribution on Windows

4.4 Building Connector/ODBC from a Source Distribution on Windows

You only need to build Connector/ODBC from source on Windows to modify the source or installation location. If you are unsure whether to install from source, please use the binary installation detailed in Section 4.1, “Installing Connector/ODBC on Windows”.

Building Connector/ODBC from source on Windows requires a number of different tools and packages:

  • MDAC, Microsoft Data Access SDK from http://support.microsoft.com/kb/110093.

  • Suitable C compiler, such as Microsoft Visual C++ or the C compiler included with Microsoft Visual Studio.

    Microsoft Visual Studio 7 and 8 are preferred, and well-tested.

  • Connector/ODBC 5.2: cmake.

  • MySQL client libraries and include files from MySQL 4.0.0 or higher. (Preferably MySQL 4.0.16 or higher). This is required because Connector/ODBC uses calls and structures that exist only starting from this version of the library. To get the client libraries and include files, visit http://dev.mysql.com/downloads/.

Build Steps

Set the environment variables for the Visual Studio toolchain. Visual Studio includes a batch file to set these for you, and installs a Start menu shortcut that opens a command prompt with these variables set.

Set MYSQL_DIR to the MySQL server installation path, while using the short-style file names. For example:

C:\> set MYSQL_DIR=C:\PROGRA~1\MySQL\MYSQLS~1.0

Build Connector/ODBC using the cmake command-line tool by executing the following from the source root directory (in a command prompt window):

C:\> cmake -G "Visual Studio 8 2005"

This produces a project file that you can open with Visual Studio, or build from the command line with either of the following commands:

C:\> devenv.com MySQL_Connector_ODBC.sln /build Release
C:\> devenv.com MySQL_Connector_ODBC.sln /build RelWithDebInfo

By default, Connector/ODBC is linked statically with the MySQL client library mysqlclient.lib. If you want to link dynamically or to another MySQL client library, use the MYSQLCLIENT_LIB_NAME option to supply the client library's name:

C:\> cmake -G "Visual Studio 8 2005" -DMYSQLCLIENT_LIB_NAME=client_lib_name_with_extension
 

To compile a debug build, set the cmake build type so that the correct versions of the MySQL client libraries are used:

C:\> cmake -G "Visual Studio 8 2005" -DWITH_DEBUG=1
C:\> devenv.com MySQL_Connector_ODBC.sln /build Debug

Upon completion, the executables are in the bin/ and lib/ subdirectories.

See Section 4.1.2, “Installing the Windows Connector/ODBC Driver Using the Zipped DLL Package” for the copy commands to complete the installation.


User Comments
Sign Up Login You must be logged in to post a comment.