Building applications using an ODBC Driver Manager

This section discusses how to build applications using an ODBC Driver Manager.

Microsoft Windows

The Microsoft ODBC Driver Manager includes either a DLL named odbc32.dll or an import library named odbc32.lib. The odbc32.dll file is located in %SystemRoot%\system32. The odbc32.lib file can appear in a number of locations, depending on which products you have installed. If you use Microsoft Visual Studio.NET, the odbc32.lib is located in the %Install Path to Microsoft Visual Studio%\ Vc7\PlatformSDK\Lib.

To link an ODBC application to the Microsoft ODBC Driver Manager, use odbc32.lib.

UNIX using unixODBC Driver Manager

The unixODBC Driver Manager includes a shared library named libodbc.so, which is a soft link to a library named libodbc.so.1. This file is typically located in the /usr/lib directory.

NoteSome older Driver Manager packages do not create the soft link from libodbc.so.1 to libodbc.so. Sybase recommends that you manually create this link. The ODBC Driver Manager also includes another shared library called libodbcinst.so.1. A soft link from this file to libodbcinst.so should also exist. If it is not on your system, you should create one.

To link an ODBC application against the unixODBC Driver Manager, pass the -lodbc flag to the linker.

If the unixODBC Driver Manager is not installed in the /usr/lib directory, you must also pass this to the linker:

-Ldir

where dir is the directory where the unixODBC Driver Manager shared libraries are located.

UNIX using the Sybase iAnywhere ODBC Driver Manager

To link an ODBC application against the Sybase iAnywhere ODBC Driver Manager, pass the -lodbc or -ldbodm flag to the linker. You must also pass the -Ldir flag to the linker, where dir is the directory where the Sybase iAnywhere ODBC Driver Manager shared libraries are located.