Open Database Connectivity (ODBC) is a protocol that you can use to connect a Microsoft Access database to an external data source such as Microsoft SQL Server. This article contains general information about ODBC data sources, how to create them, and how to connect to them by using Microsoft Access. The procedure steps might vary depending on the specific database products and ODBC drivers used.
In this article
About ODBC data sources
A data source is a source of data combined with the connection information that is required to access that data. Examples of data sources are SQL Server, Oracle RDBMS, a spreadsheet, and a text file. Examples of connection information include server location, database name, logon ID, password, and various ODBC driver options that describe how to connect to the data source. This information can be obtained from the administrator of the database to which you want to connect.
In the ODBC architecture, an application such as Access connects to the ODBC Driver Manager, which in turn uses a specific ODBC driver (for example, Microsoft SQL ODBC driver) to connect to a data source. In Access, you use ODBC data sources to connect to data sources external to Access that do not have built-in drivers.
To connect to these data sources, you must do the following:
Install the appropriate ODBC driver on the computer that contains the data source.
Define a data source name (DSN) by using either the ODBC Data Source Administrator to store the connection information in the Microsoft Windows registry or a DSN file, or a connect string in Visual Basic code to pass the connection information directly to the ODBC Driver Manager.
Machine data sources
Machine data sources store connection information in the Windows Registry on a specific computer. You can use machine data sources only on the computer they are defined on. There are two types of machine data sources — user and system. User data sources can be used only by the current user and are visible only to that user. System data sources can be used by all users on a computer and are visible to all users on the computer and system-wide services. A machine data source is especially useful when you want to provide added security, because only users who are logged on can view a machine data source and it cannot be copied by a remote user to another computer.
File data sources
File data sources (also called DSN files) store connection information in a text file, not the Windows registry, and are generally more flexible to use than machine data sources. For example you can copy a file data source to any computer that has the correct ODBC driver so that your application can rely on consistent and accurate connection information to all the computers it uses. Or you can place the file data source on a single server, share it between many computers on the network, and easily maintain the connection information in one location.
A file data source can also be unshareable. An unshareable file data source is contained on a single computer and points to a machine data source. You can use unshareable file data sources to access existing machine data sources from file data sources.
In a module, you can define a formatted connect string that specifies connection information. A connect string passes the connection information directly to the ODBC Driver Manager, and it helps simplify your application by removing the requirement that a system administrator or user first create a DSN before you use the database.
For more information about the ODBC interface, see the ODBC Programmer's Reference section of MSDN.
Add an ODBC data source
Before proceeding, obtain and install the appropriate ODBC driver for the data source to which you want to connect.
Note: You must be a member of the Administrators group on your local machine in order to add or configure an ODBC data source.
Click Start, and then click Control Panel.
In the Control Panel, double-click Administrative Tools.
In the Administrative Tools dialog box, double-click Data Sources (ODBC).
The ODBC Data Source Administrator dialog box appears.
Click User DSN, System DSN, or File DSN, depending on the type of data source you want to add. For more information, see the section About ODBC data sources.
Select the driver that you want to use, and then click Finish or Next.
If the driver you want is not listed, contact the administrator of the database you are connecting to for information about how to obtain the correct driver.
Follow the instructions and enter the required connection information in any dialog boxes that follow.
Click Help in the ODBC dialog boxes for more information about the individual settings.