When creating a connection, you must
specify several pieces of required information. Typically, this
includes the type of authentication or user to authenticate, the
location of the database server, and the name of the database. In
addition, OLE DB connection strings specify an OLE DB provider, and
ODBC connection strings specify an ODBC driver. To specify this
information, use the
ConnectionString contains a series of
name/value settings delimited by
order of these settings is unimportant, as is the
capitalization. Taken together,
they specify the information needed to create a connection. Table 3-3 describes some settings you can use.
Parameters that are used for connection pooling are omitted; they are
discussed later in this chapter.
Connection strings are data source-specific, although they tend to have broad similarities. Most parameters in Table 3-2 are supported by the SQL Server, OLE DB, and Oracle providers, although some exceptions apply. Consult the documentation for your particular database product or your OLE DB or ODBC driver for more information.
AttachDBFilename / Initial File Name
Used only if you want to connect to an attachable database file (for
example, an .mdf file that
isn’t registered with the database system).
Normally, you use the
Connect Timeout / Connection Timeout