If you want to use a connection string for connecting to a database, or if your application requires it, you must specify either a DSN (data source name) or a DSN-less connection in the string. The difference is whether you use the DSN= or the DRIVER= keyword in the connection string, as described in the ODBC specification. A DSN connection string tells the driver where to find the default connection information. Optionally, you may specify attribute=value pairs in the connection string to override the default values stored in the data source.
If your application requires a connection string to connect to a data source, you must specify the data source name that tells the driver which data source to use for the default connection information. Optionally, you may specify attribute=value pairs in the connection string to override the default values stored in the data source.
For example, a connection string may look like this:
DSN=Accounting;DB=EMP;UID=JOHN;PWD=XYZZY
or
DSN=Accounting;DB="X:IV;EMP";UID=JOHN;PWD=XYZZY
Note: If the database name (DB) contains a semicolon (;), you must place the name in quotes, as shown in the preceding example.
The DSN-less connection string specifies a driver instead of a data source. All connection information must be entered in the connection string because there is no data source storing the information.