Connection Strings
Connection strings are use in the SQLDriverConnect function in the ODBC API or in the Driver property of a Visual Basic Data Control. These strings are built from a semicolon separated list of keywords and their associated values. Strings may be enclosed in braces. These keywords may also be used in File DSN's. The connection string for the KCML ODBC driver may use only the following keywords:
Keyword | Description |
---|---|
DSN | Name of the KISAM data source. |
UID | user ID |
PWD | password |
SERVER | host name of database server |
DBNAME | database name |
MODULE | list of 2 character module codes used as a filter on lists of tables |
COMPANY | list of 2 character company codes to be used as a filter on tables. |
LANG | 0 for 8 bit Windows characters set |
CONFPWD | =Y to force login to appear even if password can be read from cache |
SHCOL | =Y for 8 column names, =N for default 20 character names |
HIDEBIT | =Y to suppress the BIT datatype |
USEROWID | =Y to expose ROWID as a datatype. Not recommended with JET |
DRIVER | Name of the driver i.e. 'KISAM 32 bit driver' |
DSN and DRIVER are mutually exclusive.
For example, to connect to the Accounting data source on the server drs6000, use the following connection string:
DSN=Accounting;UID=pjc;
If either the UID or PWD is not given then a logon dialog box will appear during connection. In the example this will cause a logon dialogue to appear on the first connection so that the password can be entered. In general it is not a good idea to embed passwords in programs using the PWD keyword. The KISAM driver will cache the DSN, UID and PWD triplet and a subsequent connection in the same Windows session will be done automatically using the cached password. If no UID is given it will take the value of the LastUid string in the ODBC.INI section. This LastUid string is updated after a successful logon.
Values of keywords supplied in the connection string will override any values in the DSN. They are normally used with the DRIVER keyword especially with ODBC 3.0 File DSN's.