You only need to install Connector/ODBC from source on Windows to change or modify the source or installation. If you are unsure whether to install from source, please use the binary installation detailed in Section 20.1.3.1, “Installing Connector/ODBC from a Binary Distribution on Windows”.
Installing 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.1: CMake.
Connector/ODBC 3.51: A compatible make
tool. Microsoft's nmake is used in the
examples in this section.
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 new 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/.
You need to have the environment variables set 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.
You need to 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 ReleaseC:\>devenv.com MySQL_Connector_ODBC.sln /build RelWithDebInfo
To compile the "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" -DCMAKE_BUILD_TYPE=DebugC:\>devenv.com MySQL_Connector_ODBC.sln /build Debug
Upon completion, the executables are in the
bin/ and lib/
subdirectories.
See Section 20.1.3.1.2, “Installing the Windows Connector/ODBC Driver using the Zipped DLL package” to complete the installation.
Connector/ODBC source distributions include
Makefiles that require the
nmake or other make
utility. In the distribution, you can find
Makefile for building the release version
and Makefile_debug for building debugging
versions of the driver libraries and DLLs.
To build the driver, use this procedure:
Download and extract the sources to a folder, then change
directory into that folder. The following command assumes
the folder is named myodbc3-src:
C:\> cd myodbc3-src
Edit Makefile to specify the correct
path for the MySQL client libraries and header files. Then
use the following commands to build and install the
release version:
C:\>nmake -f MakefileC:\>nmake -f Makefile install
nmake -f Makefile builds the release
version of the driver and places the binaries in
subdirectory called Release.
nmake -f Makefile install installs
(copies) the driver DLLs and libraries
(myodbc3.dll,
myodbc3.lib) to your system
directory.
To build the debug version, use
Makefile_Debug rather than
Makefile, as shown below:
C:\>nmake -f Makefile_debugC:\>nmake -f Makefile_debug install
You can clean and rebuild the driver by using:
C:\>nmake -f Makefile cleanC:\>nmake -f Makefile install
Make sure to specify the correct MySQL client libraries
and header files path in the Makefiles (set the
MYSQL_LIB_PATH and
MYSQL_INCLUDE_PATH variables). The
default header file path is assumed to be
C:\mysql\include. The default
library path is assumed to be
C:\mysql\lib\opt for release DLLs
and C:\mysql\lib\debug for debug
versions.
For the complete usage of nmake, visit http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vcce4/html/evgrfRunningNMAKE.asp.
If you are using the Subversion tree for compiling, all
Windows-specific Makefiles are
named as Win_Makefile*.
After the driver libraries are copied/installed to the system
directory, you can test whether the libraries are properly
built by using the samples provided in the
samples subdirectory:
C:\>cd samplesC:\>nmake -f Makefile all

User Comments
Add your own comment.