SQL Anywhere ODBC Configuration

The SQL Anywhere ODBC Configuration dialog box contains the following fields.  These fields correspond to the connection parameters.  See Connection Parameters for a description of the connection parameters and a description of the manner in which they are used to establish a connection with a database.

Data Source Name

This should be a short name for the data source, such as Orders or Accounts Payable.

Description

A longer description of the data source.

User ID

(Optional) The user name to be used when connecting.  If it is omitted, most ODBC applications will prompt you for a user ID and password when connecting to the data source.

Password

(Optional) The password for the supplied User ID.  Since the password supplied is stored in odbc.ini, setting the password here may be a security risk.  If the password is omitted, most applications will prompt you to enter your password when connecting to the data source.

Server Name

The name of a SQL Anywhere database engine or the name of a SQL Anywhere network server.  If not specified, the default local engine is used (the first database engine started).  This field corresponds to the EngineName connection parameter.

Database Name

If specified, this corresponds to the name of a database already running on a SQL Anywhere database engine or SQL Anywhere network server.  This field corresponds to the DatabaseName connection parameter.

Database File

If specified, this contains the name of a database file--such as c:\sqlany50\sademo.db.  You can use the Browse button to locate a database file name to place in this field.  This field corresponds to the DatabaseFile connection parameter.

Local, Network, Custom

The command used to run the database software when the named database engine or server is not already executing.  You can select Local or Network, as appropriate, if the default settings are satisfactory.  Otherwise, select Custom and enter the command including any command line parameters by pressing the Options button.

Translator Name

If specified, this contains the name of an ODBC translator.  A translator DLL causes all data passing between an application and the database to be translated.  The SQL Anywhere translator performs character set translation between the ANSI and OEM character sets.  Use the Select button to choose one of the installed translators.

Microsoft Applications (Keys in SQLStatistics)

The ODBC specification states that primary and foreign keys should not be returned by SQLStatistics.  Some programs (including Microsoft Visual Basic V3.0 and Microsoft Access V1.0 and V1.1) assume that primary and foreign keys are returned by SQLStatistics.  Checking this option makes the SQL Anywhere ODBC driver mimic the required behavior so these applications work properly.

Prevent Driver not Capable Errors

The SQL Anywhere ODBC driver returns a "Driver not Capable" error code because it does not support qualifiers.  Some ODBC applications do not handle this error properly.  Checking this box disables this error code, allowing these applications to work.

Delay Autocommit until Statement Close

The ODBC standard specifies that the default mode of operation is to run in auto-commit mode (each statement is committed immediately after it is executed).  Some applications do not provide a way for users to override this behaviour.  Checking this option causes the SQL Anywhere ODBC driver to delay the commit operation until the statement is closed.


Connection Parameters

The connection parameters are a string used to specify how to connect to a database engine or network server.  This string is a list of parameter settings of the form KEYWORD=value, delimited by semicolons.  The number sign "#" is an alternative to the equals sign, and should be used when setting the connection parameters string in the SQLCONNECT environment variable, as using "=" inside an environment variable setting is a syntax error.  The keywords are from the following table.

Verbose keyword	Short form

Userid	UID

Password       	PWD

ConnectionName 	CON

EngineName     	ENG

DatabaseName   	DBN

DatabaseFile   	DBF

DatabaseSwitches	DBS

AutoStop       	AutoStop

Start          	Start

Unconditional  	UNC

DBBACKUP, DBUNLOAD, DBVALID, DBWATCH, and ISQL will take the following steps for connecting to the database.  Applications that use the ODBC SQLDriverConnect or db_string_connect will get the same behaviour.  Note that the ODBC function SQLDriverConnect does not support the use of the ConnectionName parameter.  These parameter settings are used as default values for unspecified parameters to SQLDriverConnect.

•	Look for a local database engine that has a name that matches the EngineName parameter.  If no EngineName is specified, look for the default local database engine (the first database engine started).

•	Look for the network requestor.

•	If DatabaseName is specified, look for a local database engine that has a name that matches the DatabaseName parameter.

•	If DatabaseName is not specified and DatabaseFile is specified, look for a local database engine that matches the root of the file name.  For example, if DatabaseFile is c:\sqlany50\sademo.db, then look for a local engine named sademo.

•	If no matching local engine is found and the SQL Anywhere Client (DBCLIENT) is not running, start a database engine or SQL Anywhere Client using the Start parameter (or the default start command).  The AutoStop parameter determines if the engine automatically stops when the last database is shut down or if the SQL Anywhere Client automatically stops when its last connection is gone.

Once an engine or server has been found, SQLDriverConnect or db_string_connect will attempt to establish a connection:

•	If the database named by DatabaseName or DatabaseFile is not currently running, send a request to the engine or network server to start a database using the DatabaseFile, DatabaseName, and DatabaseSwitches parameters.  The AutoStop parameter will determine if the database automatically shuts down when the last connection to the database is disconnected.

•	Send a connection request to the database engine or network server based on the Userid, Password, and ConnectionName parameters.

For example, consider the following parameters:

     DBF=c:\sqlany50\sademo.db;UID=dba;PWD=sql

1.	If there is a local engine with the name sademo, then you will connect to it.

2.	If the client is running and there is a server with the name sademo, then you will connect to it.

3.	Otherwise, a local engine will be started on the file c:\sqlany50\sademo.db.  If the database exists, and the engine starts without errors, then you will be connected to that engine.

The Userid and Password specify the authorization information to the database engine.  The ConnectionName is optional and allows you to name the connection established with the database engine.

The Start parameter allows you to specify a command line for starting the database engine or SQL Anywhere Client.  The default start command is DBENG50 -q ( DBENG50W -q for Windows 3.x).  Before Watcom SQL Version 4.0, the start string required a %d somewhere in the command as a placeholder for the database name.  This is no longer necessary because the information is passed as EngineName or as DatabaseFile.


Table of Contents

SQL Anywhere ODBC Configuration

Connection Parameters