Instead of a dialog box, some applications might require a connection string that specifies, using particular attributes, how a driver connects to a data source. Each attribute identifies specific information that the driver needs to make a successful connection. The connection string format is always as follows:

Copy Code
"DSN=<data-source-name> ;[SERVER=<value>] [;PWD=<value>] [;UID=<value>] [;<Attribute>=<value>]"
Note:
The Microsoft ODBC Driver for Oracle also supports the CONNECTSTRING argument from the first version (1.x) of the driver.

You must specify the data source name if you do not specify the UID, PWD, SERVER (or CONNECTSTRING), and DRIVER attributes. However, all other attributes are optional. When an attribute is unspecified, the attribute specified in the DSN tab of the ODBC Data Source Administrator dialog box is the default.

The connection string attributes are described in the following table:

Attribute Description Default value

DSN

The data source name, listed in the User DSN or System DSN tab of the ODBC Data Source Administrator dialog box.

""

PWD

The password for the Oracle Server you want to access. This driver supports the Oracle limit of 30 characters and has the same limitations as Oracle places on passwords.

""

SERVER

The string for the Oracle Server you want to access.

This string can be an Oracle database alias, an entry in the Tnsnames.ora file, or an alias that will be mapped to the correct server using Oracle Names Server.

A database alias can be set up using Oracle's SQL*Net Fast Configuration (or Net8 Easy Configuration for Oracle8 databases). For more information about connecting to an Oracle database, see your Oracle documentation.

""

UID

The Oracle Server user name. This attribute might not be optional—certain databases and tables might require this attribute for security purposes.

To indicate Oracle's operating system authentication, use "UID=/;".

""

BUFFERSIZE

The optimal buffer size for fetching columns.

The driver optimizes fetching so that one fetch from the Oracle Server returns enough rows to fill a buffer of this size.  Larger values tend to increase performance if you fetch a lot of data.

65535

SYNONYMCOLUMNS

When this value is true (1), a SQLColumns API call returns column information for Tables, Views, and Synonyms. Otherwise, SQLColumns returns only columns for Tables and Views. For faster performance, do not set this value.

1

REMARKS

When this value is true (1), the driver returns Remarks columns for the SQLColumns result set. For faster performance, do not set this value.

0

StdDayOfWeek

Enforces the ODBC standard for the DAYOFWEEK scalar. This is the default value; users needing the localized version can change the behavior to use whatever Oracle returns.

1

Note:
Attribute values might be case-sensitive.

Examples

The following connection string connects to the Employees data source by using the Oracle Server mickey.world and the Oracle User cindy:

Copy Code
"DSN=Employees;UID=cindy;PWD=secret;SERVER=mickey.world"

The following connection string connects to the Payroll data source by using Oracle's operating system authentication and the Oracle Server moola:

Copy Code
"DSN=Payroll;UID=/;PWD=;SERVER=moola"