Connection parameter syntax rules

  • Connection strings containing spaces   When specifying a connection string on the command line, you must enclose the entire connection string in double quotes if any of the connection parameter values contains 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 parameter names are case insensitive, although their values may not be (for example, file names on Unix).

  • Character set restrictions   It is recommended that the database server name (specified by the ServerName connection parameter) be composed of the ASCII character set in the range 32 to 126. This limitation does not apply to other connection parameter values.

  • Priority  

    Caution

    Do not specify a parameter more than once in a connection string. If you specify a parameter more than once, the results are not guaranteed and may be inconsistent. As well, the behavior may change in a future release of the software.

    The following rules govern the priority of connection parameters:
    • The entries in a connection string are read left to right. If the same connection parameter is specified more than once, the last one in the string applies. ODBC and OLE DB client applications (except for Sybase Central, Interactive SQL, and the SQL Anywhere Console utility) are exceptions to this behavior: if the same parameter is specified more than once, then the first value in the string applies.

    • In order of precedence, the interface library gets connection parameters from the following sources:

      • 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 connection parameters.

        If a connection string and an ODBC data source both specify the same connection parameter, then the value from the connection string is used and the value from the data source is ignored.

        For example, assume that the database server demo12 is running the databases demo and demo2. The following command creates a data source for the demo database.

        dbdsn -w demodsn -c "ServerName=demo12;Host=myhost;dbn=demo" -y

        The connection string DBN value (DBN=demo2) has higher precedence than the data source's DBN value.

        dbping -d -c "UID=DBA;PWD=sql;DBN=demo2;DSN=demodsn"

        The connection parameters used to connect are:

        UID=DBA;PWD=sql;DBN=demo2;ServerName=demo12;Host=myhost

  • 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.

 See also