Building applications using an ODBC Driver Manager

You can build applications using an ODBC Driver Manager on the following operating systems:

Windows

The Microsoft ODBC Driver Manager includes a dll named odbc32.dll or an import library named odbc32.lib. On Windows 2000, 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 against the Microsoft ODBC Driver Manager, use odbc32.lib.

Linux

The ODBC 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.

StepsTo link an ODBC application against the ODBC Driver Manager

  1. Pass the -lodbc flag to the linker.

    If the ODBC Driver Manager is not installed in the /usr/lib directory, you also need to pass the -Ldir flag to the linker,

    where:

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

Mac OS X

StepsTo link an ODBC application against the iODBC Driver manager

The iODBC Driver Manager includes a dynamic library named libiodbc.dylib, typically located in the /usr/lib directory.

  1. Pass the -liodbc flag to the linker.

If you use the unixODBC Driver Manager instead of iODBC, the linker flag should be -lodbc.

If the ODBC Driver Manager is not installed in the /usr/lib directory, you also need to pass the -Ldir flag to the linker,

where:

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