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

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere ODBC API » Building ODBC applications

 

Linking ODBC applications on Windows Mobile

On Windows Mobile operating systems, there is no ODBC driver manager. The import library (dbodbc11.lib) defines entry points directly into the SQL Anywhere ODBC driver dbodbc11.dll. This file is located in the SDK\Lib\CE\Arm.50 subdirectory of your SQL Anywhere installation.

Since there is no ODBC driver manager for Windows Mobile, you must specify the location of the SQL Anywhere ODBC driver DLL for the DRIVER= parameter in the connection string supplied to the SQLDriverConnect function. The following is an example.

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

Here, ospath is the full path to the Windows directory on the Windows Mobile device. For example:

\\Windows
♦  To link an ODBC application (Windows Mobile)

For a list of supported versions of Windows Mobile, see the SQL Anywhere for PC Platforms table in [external link] http://www.sybase.com/detail?id=1002288.

The sample program (odbc_sample.cpp) uses a File Data Source (FileDSN connection parameter) called SQL Anywhere 11 Demo.dsn. This file placed in the root directory of your Windows Mobile device when you install SQL Anywhere for Windows Mobile to your device. 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 environment and then edited to match the Windows Mobile environment. After appropriate edits, you can copy them to your Windows Mobile device.

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

Windows Mobile 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.