Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Programming » ODBC support


ODBC application development

Every C/C++ source file that calls ODBC functions must include a platform-specific ODBC header file. Each platform-specific header file includes the main ODBC header file odbc.h, which defines all the functions, data types, and constant definitions required to write an ODBC program.

Perform the following tasks to include the ODBC header file in a C/C++ source file:

  1. Add an include line referencing the appropriate platform-specific header file to your source file. The lines to use are as follows:

    Operating system Include line
    Windows #include "ntodbc.h"
    Unix #include "unixodbc.h"
    Windows Mobile #include "ntodbc.h"
  2. Add the directory containing the header file to the include path for your compiler.

    Both the platform-specific header files and odbc.h are installed in the SDK\Include subdirectory of your SQL Anywhere installation directory.

  3. When building ODBC applications for Unix, you might have to define the macro "UNIX" for 32-bit applications or "UNIX64" for 64-bit applications to obtain the correct data alignment and sizes. This step is not required if you are using one of the following supported compilers:

    • GNU C/C++ compiler on any supported platform
    • Intel C/C++ compiler for Linux (icc)
    • SunPro C/C++ compiler for Linux or Solaris
    • VisualAge C/C++ compiler for AIX
    • C/C++ compiler (cc/aCC) for HP-UX

Once your source code has been written, you are ready to compile and link the application. The following sections describe how to create executable applications.

ODBC applications on Windows
ODBC applications on Windows Mobile
ODBC applications on Unix
The SQL Anywhere ODBC driver manager for Unix
The unixODBC driver manager
UTF-32 ODBC driver managers for Unix