Working with the ODBC database interface  About ASA data sources

Chapter 14: Using database interfaces

Connecting to an ASA database on Windows CE

In the development environment, the ODBC driver manager provides an interface between the PocketBuilder ODB interface (pkodb20.dll) and the ASA version 9 ODBC driver (dbodbc9.dll). The driver manager can handle three types of data source name (DSN) files: system DSNs, user DSNs, and file DSNs. You can create a database connection profile using any of these DSN types.

In applications that you deploy to Windows CE, you must use a file DSN because there is no ODBC driver manager.

Using file DSNs

Windows CE does not provide an ODBC driver manager or an ODBC Administrator. On Windows CE, Adaptive Server Anywhere uses ODBC data sources stored in ANSI format files. A file DSN has the same name as the data source, with the extension .dsn, and is usually stored at the root level of the device.

Windows CE also searches for data source files in the following locations:

You can specify either the DSN or the FILEDSN keyword to use file data source definitions in a script. On Windows CE, DSN and FILEDSN are synonyms.

The data source typically specifies the location of the database and the database engine. For more information about defining data sources, see “About ASA data sources”.

Using a different ASA ODBC driver

The default ASA ODBC driver supplied with Adaptive Server Anywhere version 9 is dbodbc9.dll. You can specify a different ASA ODBC driver by including “driver=dbodbcX.dll” in the ConnectString parameter in the DBParm value or in the file data source, where X is the version number of the ASA ODBC driver.

For example, to use an ASA 8 ODBC driver on the Windows CE device, you can set the following DBParm value in a script (SQLCA is the default connection object):

SQLCA.DBPARM="ConnectString='DSN=myDSN;driver=dbodbc8.dll;UID=dba;PWD=sql'"
CONNECT using SQLCA;

If you are running your PocketBuilder applications from the desktop, use the actual name of the driver (for example, “Adaptive Server Anywhere 8.0”) in the ConnectString parameter rather than the name of the DLL. Otherwise, the driver you select in the connection string might be ignored.

For more information about setting SQLCA parameters, see “Assigning values to the Transaction object”.

The DSN you assign must exist in the root directory on the Windows CE device or emulator, or in the \Windows directory or the directory from which the server was started. You can include the driver name in the DSN instead of the DBParm by adding an assignment for the driver in the DSN file:

[ODBC]
enginename=asademo
databasename=asademo
databasefile=\Program Files\Sybase\ASA\asademo.db
start=\Program Files\Sybase\ASA\dbsrv9.exe
Driver=dbodbc9.dll




Copyright © 2004. Sybase Inc. All rights reserved. About ASA data sources

View this book as PDF