## Using the MaxDB ODBC Driver

### Use

If you want to use the MaxDB ODBC driver, you have the following options:

● Register the MaxDB ODBC driver in a driver manager. You can use the following driver managers:

○ Microsoft Windows: Microsoft ODBC Driver Manager 3.52 or higher

○ UNIX/Linux: unixODBC 2.0.9 or higher, iODBC 3.0.5 or higher

● Link the MaxDB ODBC driver directly with the application (only on UNIX/Linux)

### Prerequisites

● On Microsoft Windows, you require Microsoft Data Access Components (MDAC) Version 2.7 or higher.

● You have installed the MaxDB ODBC driver.

The ODBC driver is contained in the installation profiles Server, Web Tools and DB Analyzer as well as in the software component ODBC. For more information, see Installation Manual.

Installing the ODBC Driver

Operating System | Installation Procedure | Directory | Comments
Microsoft Windows | Standard installation | <independent_program_path>\pgm Example: C:\Program Files\sdb\programs\pgm See also Installation Manual, Directories | The system stores information about all installed ODBC drivers in the registry in the key HKEY_LOCAL_MACHINE/SOFTWARE/ODBC/ODBCINST.INI and also creates a driver-specific key for each ODBC driver.
UNIX/Linux | Standard installation | <independent_program_path>/pgm Example: /opt/sdb/programs/pgm |
Linux | rpm installation | /opt/sdb/interfaces/odbc |

Files of the MaxDB ODBC Driver

Operating System | File Name | Description
Microsoft Windows | sqlod32.dll sqlod32w.dll | Library of the MaxDB ODBC driver (ASCII) Library of the MaxDB ODBC driver (Unicode)
| odbcreg.exe | Program for entering the driver information in the registry
UNIX/Linux | libsqlod.a, libsqlod.so libsqlodw.a, libsqlodw.so | Library of the MaxDB ODBC driver (ASCII, static/dynamic) Library of the MaxDB ODBC driver (Unicode, static/dynamic)
| incl/sql.h | ODBC driver header file (core API)
| incl/sqlext.h | ODBC driver header file (level 1 API and level 2 API)
| incl/sqltypes.h | ODBC driver header file (data types)
| incl/sqlucode.h | ODBC driver header file (Unicode)
| incl/WINDOWS.H | Header file for UNIX/Linux platforms

### Activities

#### Registering the ODBC Driver in the Driver Manager

You can find information about registering an ODBC driver in the driver manager in the documentation provided by the manufacturer of the driver manager.

#### Linking the ODBC Driver with the Application (only on UNIX/Linux)

You can link the MaxDB ODBC driver with the application either statically (library libsqlod.a) or dynamically (library libsqlod.so).

In the case of a dynamic link, ensure that the system finds the dynamic library libsqlod.so when you execute the application by adding the path for libsqlod.so to the environment variable LD_LIBRARY_PATH.

You compile the application myapp.c with the appropriate ODBC header files:

cc –c myapp.c –I<ODBC_include>

You link the ODBC driver statically with the application:

cc –o myapp myapp.o <ODBC_lib>/libsqlod.a

You link the ODBC driver dynamically with the application:

cc –o myapp myapp.o –L<ODBC_lib> -lsqlod

See also:

Creating/Changing a Data Source