About ASA data sources  Defining multiple data sources for the same data

Chapter 14: Using database interfaces

Defining the ASA data source

You can define user, system, or file data sources. If you want to use the data source on a Pocket PC, define a file data source. Windows CE supports only file data sources.

When you create a local ASA database in the Database painter, PocketBuilder automatically creates a data source definition and database profile for you. Therefore, you do not need to define a user data source for use on the desktop, but you do need to define a file data source if you want to deploy the database to a remote device.

Defining file data sources

You can use the ODBC Data Source Administrator utility to create a file data source, but in general it is easier to use a text editor. The file should be saved with ANSI encoding.

The following example shows the format of the file. The database name and engine name are usually the same as the name of the database file without the .db extension. In the example, the database file is MyRemoteDB.db, and on the device it will be installed in the same directory as the application, \Program Files\AcmeTools:

[ODBC]
uid=dba
pwd=sql
enginename=MyRemoteDB
databasename=MyRemoteDB
databasefile=\Program Files\AcmeTools\MyRemoteDB.db
start=\Program Files\Sybase\ASA\dbsrv9.exe

Defining system and user data sources

Use the following procedure to define a system or user data source for use on a desktop or server:

StepsTo define an ASA data source for the ASA driver:

  1. Launch the ODBC Data Source Administrator utility. From the User or System DSN tab page, click the Add button.

    The Create New Data Source dialog box displays.

  2. Select the ASA driver and click Finish.

    The ODBC Configuration for ASA dialog box displays.

    Figure 14-2: The ODBC Configuration dialog box

  3. You must supply the following values:

    Use the Help button to get information about boxes in the dialog box.

    NoteUsing the Browse button When you use the Browse button to supply the Database File name (for example, asademo.db), this name also displays without the extension in both the Data Source Name and Database Name boxes. This might change values that you previously supplied in these boxes.

    If you want to specify a different name for the data source or database, you can edit one or both of these boxes after using the Browse button.

  4. Click OK to save the data source definition.

Specifying a Start Line value

When the ASA ODBC driver cannot find a running database server using the PATH variable and Database Name setting, it uses the commands specified in the Start Line field to start the database server.

If you are creating a DSN for use on a Pocket PC device, specify the name of the network database server and its location on the device, usually \Program Files\Sybase\ASA\dbsrv9.exe.

If you are creating a DSN for use in the development environment only, you can specify the name and location of the personal database server. The default location is C:\Program Files\Sybase\SQL Anywhere 8\win32\dbeng9.exe.

Preventing the ASA log screen from displaying

You can add a -q switch to the start line to prevent the ASA log screen from displaying when you connect to the database. The start line in a file DSN for use on a Pocket PC device would look like this:

start=\Program Files\Sybase\ASA\dbsrv9.exe -q

Because the connection might take a few moments, you might want to call the SetPointer function to display the Windows CE version of the hourglass icon when using the -q switch. On Windows CE, you need to explicitly call the SetPointer function to reset the default pointer when the script completes.

For more information on completing the ODBC Configuration For Adaptive Server Anywhere dialog box, see the Adaptive Server Anywhere Database Administration Guide in the ASA documentation set.





Copyright © 2004. Sybase Inc. All rights reserved. Defining multiple data sources for the same data

View this book as PDF