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

SQL Anywhere 10.0.1 » SQL Anywhere Server - Programming » SQL Anywhere ODBC API » Building ODBC applications

Linking ODBC applications on Windows Next Page

Linking ODBC applications on Windows CE


On Windows CE operating systems there is no ODBC driver manager. The import library (dbodbc10.lib) defines entry points directly into the SQL Anywhere ODBC driver dbodbc10.dll.

Separate versions of this DLL are provided for the different chips on which Windows CE is available. The files are in operating-system specific subdirectories of the ce directory in your SQL Anywhere installation directory. For example, the ODBC driver for Windows CE on the ARM chip is in the following location:

C:\Program Files\SQL Anywhere 10\ce\arm.30

For a list of supported versions of Windows CE, see the SQL Anywhere for PC Platforms table in [external link] SQL Anywhere Supported Platforms and Engineering Support Status.

To link an ODBC application (Windows CE)
  1. Add the directory containing the platform-specific import library to the list of library directories.

    The import library is named dbodbc10.lib and is stored in an operating-system specific location under the ce directory in your SQL Anywhere installation directory. For example, the import library for Windows CE on the ARM chip is in the following location:

    C:\Program Files\SQL Anywhere 10\ce\arm.30\lib
  2. Specify the DRIVER= parameter in the connection string supplied to the SQLDriverConnect function.

    szConnStrIn = "driver=ospath\\dbodbc10.dll;dbf=\\samples-dir\\demo.db"

    where ospath is the full path to Windows directory on the Windows CE device. For example:

    \\Windows

    For information about the default location of samples-dir, see Samples directory.

  3. The sample program (odbc_sample.cpp) uses a File data source (FileDSN connection parameter) called SQL Anywhere 10 Demo.dsn. There is a copy of this file in the ce directory in your SQL Anywhere installation directory. You can create file data sources on your desktop system with the ODBC Data Source Administrator, but they must be set up for your desktop system and then edited to match the Windows CE environment. After appropriate edits, you can copy them to your Windows CE device.

    Windows CE and Unicode

    SQL Anywhere uses an encoding known as UTF-8, a multibyte character encoding that can be used to encode Unicode.

    The SQL Anywhere ODBC driver supports either ASCII (8-bit) strings or Unicode code (wide character) strings. The UNICODE macro controls whether ODBC functions expect ASCII or Unicode strings. If your application must be built with the UNICODE macro defined, but you want to use the ASCII ODBC functions, then the SQL_NOUNICODEMAP macro must also be defined.

    The sample file samples-dir\SQLAnywhere\C\odbc.c illustrates how to use the Unicode ODBC features.