2 How to compile ODBC on Windows
To be able to compile the Erlang ODBC application on Windows the following are required:
- Erlang/OTP
- Visual C++ version 5.0 or higher
- ODBC drivers for your database
2.1 C-compiler on Windows
The C-part of Erlang ODBC application on Windows should be compiled with Visual C++ version 5.0 or higher. Visual C++ require certain environment variables to be set properly, i.e., point to the subdirectories of your Visual C++ installation:
- PATH - the
\bin
directory
- LIB - the
\lib
dircetory.
- INCLUDE - the
\include
dircetory.
When you install Visual C++, the batch file VCVARS32.BAT is created, which contains commands for modifying the PATH, LIB and INCLUDE environment variables. If these variables have not been set properly, run VCVARS32.BAT, located in the \bin subdirectory, before you compile at the command prompt.
2.2 Configuring the Erlang ODBC application
After installing Erlang, the Erlang ODBC application source code is located in the
<OTPROOT>\lib\odbc-<odbcversion>\src
subdirectory. <OTPROOT> is normally the path"C:\Program Files\erl<erlang version>"
. In this subdirectory you find a Makefile, in which there is a path to the ODBC import library and paths to the header files used by the Erlang ODBC application. These paths must be set properly.2.3 Configuring Makefile
As mention before Erlang ODBC application requires the ODBC import library (ODBC32.LIB) and header files. The Visual C++ \lib subdirectory contains the import library and \include the header files. Hence, depending on where Visual C++ is installed, set the variables in the Makefile to:
ODBCLIBS = "C:\Program Files\Microsoft Visual Studio\VC98\lib\Odbc32.lib"
ODBCINCLUDE = "C:\Program Files\Microsoft Visual Studio\VC98\include"
The Erlang ODBC application uses the Erl_interface header files and lib file. The variable EIROOT defines the path to the Erl_Interface application, e.g.
$(OTPROOT)\lib\erl_interface-3.2.3
. EIROOT must point to the version of Erl_Interface you intend to use, e.g., you might have to change the subdirectoryerl_interface-3.2.3
to represent a later version.2.4 Compile ODBC
- Start command prompt (The DOS windows).
- Change to the \bin subdirectory of your Visual C++ installation.
- Run VCVARS32.BAT by typing VCVARS32.
- Change to
<OTPROOT>\lib\odbc-<odbcversion>\src
subdirectory.
- Compile ODBC by typing
nmake
.