Connection parameters often provide more than one way of accomplishing a given task. This is particularly the case with embedded databases, where the connection string starts a database server. For example, if your connection string starts a database, you can specify the database name using the DatabaseName (DBN) connection parameter or using the DatabaseSwitches (DBS) parameter. The Database Name (DBN) connection parameter is recommended.
Here are some recommendations and notes for situations where connection parameters conflict:
Specify database files using DBF You can specify a database file in the StartLine (START) parameter or using the DatabaseFile (DBF) connection parameter (recommended).
Specify database names using DBN You can specify a database name in the StartLine (START) parameter, the DatabaseSwitches (DBS) connection parameter, or using the DatabaseName (DBN) connection parameter (recommended).
Specify database server names using ENG You can specify the name of the database server in the ServerName (ENG) parameter when you are attempting to autostart a database file if it is not already running. This ensures that the database connects to the intended database server.
Use the Start parameter to specify cache size Even though you use the DatabaseFile (DBF) connection parameter to specify a database file, you may still want to tune the way in which it starts. You can use the StartLine (START) connection parameter to do this.
For example, suppose you want to provide additional cache memory in the StartLine (START) connection parameter. The following set of embedded database connection parameters starts a database server with extra cache:
DBF=samples-dir\demo.db DBN=Sample ENG=Sample Server UID=DBA PWD=sql START=dbeng11 -c 8M |
Connection strings containing spaces You must enclose the entire connection string in double quotes if any of the connection parameter values contain spaces.
Boolean values Boolean (true or false) arguments are either YES, ON, 1, TRUE, Y, or T if true, or NO, OFF, 0, FALSE, N, or F if false.
Case sensitivity Connection parameters are case insensitive, although their values may not be (for example, file names on Unix).
The connection parameters used by the interface library can be obtained from the following places (in order of precedence):
Connection string You can pass parameters explicitly in the connection string.
SQLCONNECT environment variable The SQLCONNECT environment variable can store connection parameters.
Data sources ODBC data sources can store parameters.
Character set restrictions It is recommended that the server name must be composed of the ASCII character set in the range 1 to 127. There is no such limitation on other parameters.
Priority The following rules govern the priority of parameters:
Connection string parsing If there is a problem parsing the connection string, an error is generated that indicates which connection parameter caused the problem.
Empty connection parameters Connection parameters that are specified with empty values are treated as a zero length string.
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |