## 3 How to compile ODBC on Unix

To be able to compile the Erlang ODBC application on Unix the following are required:

1. Erlang/OTP
2. GCC (GNU Compiler Collection) C-Compiler version 2.7.2 or higher
3. ODBC drivers for your database

### 3.1 C-compiler on Unix

The C-part of Erlang ODBC application on Unix should be compiled with GCC C-compiler version 2.7.2 or higher. The GCC C-compiler must be found in the `PATH` environment variable. This is easily verified by running the Unix command `which gcc`.

### 3.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> can, for example, be the path `/usr/local/erlang`. In this subdirectory you find a Makefile, in which there is a path to the ODBC import library and the header files. These paths must be set properly.

### 3.3 Configuring Makefile

As mentioned earlier, Erlang ODBC application depends on the ODBC import library and header files, which are a part of the ODBC driver for your database.

To be able to access the import library you must set the variables ODBCLDFLAGS, ODBCLIBS and ODBCINCLUDE properly in the Makefile. ODBCLDFLAGS defines the path of ODBC import library, ODBCLIBS defines the name of ODBC import library and ODBCINCLUDE defines the path to the ODBC header files.
The Erlang ODBC application also uses header files from the Erl_Interface. Hence, the variable EIROOT, which defines the path to the Erl_Interface application, e.g., `$(OTPROOT)/lib/erl_interface-3.2.3`, must be point to the version of Erl_Interface you intend to use. To be able to use a later version, EIROOT must be updated.

### 3.4 Compile ODBC

1. Change to`<OTPROOT>/lib/odbc-<odbcversion>/src` subdirectory.
2. Compile ODBC by typing `gmake`.

Copyright © 1991-2002 Ericsson Utvecklings AB