Setting Up a Connection in Applications

Previous Next

ODBC API has three API functions to establish a connection: SQLDriverConnect, SQLBrowseConnect and SQLConnect.

SQLDriverConnect and SQLBrowseConnect use connection strings to define a connection. Connection strings have the following formal specification:

connection-string ::= empty-string[;] | attribute[;] | attribute; connection-string

empty-string ::=

attribute ::= attribute-keyword=attribute-value | DRIVER=[{]attribute-value[}]

attribute-keyword ::= DSN | UID | PWD| driver-defined-attribute-keyword

attribute-value ::= character-string

driver-defined-attribute-keyword ::= identifier

 

where DSN sets data source name, UID sets username and PWD sets a password.

Character-string has zero or more characters; identifier has one or more characters; attribute-keyword is not case-sensitive; attribute-value may be case-sensitive; and the value of the DSN keyword may consist solely of blanks.

The SQLConnect API uses three separate string arguments for data source name, user name and password.

The USoft Remote Rules Service ODBC setup dialog does not have fields for user name (UID) or password (PWD). Hence, the Remote Rules Service API always expects UID and PWD attributes to be set in the connection string or in the API call argument. If either user name or password is missing, the Remote Rules Service will display a message box where the user can provide the missing UID and/or PWD values.