An ODBC connection string is a text string used to specify parameters for connecting to a database via ODBC, including details like the driver, server, database name, and credentials. A DSN (Data Source Name) connection string references a preconfigured data source stored in the system’s ODBC Data Source Administrator, which contains settings like the driver and server details, simplifying connections (e.g., DSN=myDataSource;UID=user;PWD=password
).
In contrast, a file connection (or DSN-less connection) embeds all connection details directly in the string, bypassing the need for a preconfigured DSN (e.g., Driver={SQL Server};Server=myServer;Database=myDB;UID=user;PWD=password
). DSN connections are easier to manage for shared or reusable configurations, while file connections offer flexibility and portability since they don’t rely on system-specific DSN entries.
Here are some connection strings that are commonly used. For more examples see ConnectionStrings