Managing Data Sources
After you have installed an ODBC driver from the driver’s setup program, you can define one or more data sources for it. The data source name should provide a unique description of the data; for example, Payroll or Accounts Payable. The user and system data sources that are defined for all the currently installed drivers are listed in the User DSN or System DSN tabs of the Administrator dialog box. The file data sources in a given directory are listed in the File DSN tab; the directory to be shown is entered in the Look In text box in the File DSN tab.
A data source associates a particular ODBC driver with the data you want to access through that driver. For example, you might create a data source to use the ODBC dBASE driver to access one or more dBASE files found in a specific directory on your hard disk or a network drive. With the ODBC Administrator, you can add, delete, and configure the data sources you require.
Note Data sources for 32-bit drivers can be used by both 16-bit and 32-bit applications. The Driver Manager provides thunking layers to allow 16-bit applications to use 32-bit drivers.
Adding Data Sources
You can add multiple data sources, each one associating a driver with some data you want to access by using that driver. You need to give each data source a name that uniquely identifies that data source. For example, if you create a data source for a set of dBASE files that contain customer information, you might name the data source “Customers.” Applications typically display data source names for users to choose from.
To add a user or system data source
-
Make sure the ODBC Administrator is running. (See “Running the ODBC Administrator.”)
-
On the User DSN or System DSN tab, click the Add button. The Create New Data Source dialog box appears, displaying the names of installed drivers.
-
(Optional) If the data source you want to add requires a driver that has not been installed, install the driver first by using the driver’s Setup program.
-
From the ODBC drivers list, select the driver for the data source to use.
-
Click Finish.
-
A driver-specific Setup dialog box for the data source appears. Because each driver is different, each data source requires a slightly different configuration. Because of this, each data source has a unique Setup dialog box. For detailed information about the options in a data source Setup dialog box, click the Help button in the dialog box.
-
Type the required information about the data source, such as its name and file version (for example, dBASE III or dBASE IV), and then click OK.
The driver-specific Setup dialog box disappears.
-
If you want to add more user data sources, repeat steps 2-5.
-
To close the ODBC Administrator, click Cancel.
To add a file data source
-
Make sure the ODBC Administrator is running. (See “Running the ODBC Administrator.”)
-
On the File DSN tab in the Look In text box, enter the directory in which the file data source should be saved, then click Add. The Create New Data Source dialog box appears, displaying the names of installed drivers.
-
(Optional) If the data source you want to add requires a driver that has not been installed, install the driver first by using the driver’s Setup program.
-
From the drivers list, select the driver for the data source to use.
-
To enter driver-specific information, click the Advanced button.
-
Enter keyword value pairs in the text box. (For more information about driver-specific keywords, see the driver’s documentation.)
-
To verify that the connection is valid before creating the file data source, click Verify This Connection, and then click OK.
-
Click Next.
-
Type the name of the file data source, or click Browse to find the name you want in the directory structure, click Save, and then click Next.
-
Verify that the information displayed is correct, then click Finish. A driver-specific Setup dialog box for the data source appears. Because each driver is different, each data source requires a slightly different configuration. Because of this, each data source has a unique Setup dialog box. For detailed information about the options in a data source Setup dialog box, click Help in the dialog box.
Note When you create a file data source, you do not need to enter a name. When you click OK, a file data source with the name entered in step 6 and a DSN extension is created in the selected directory.
For more information about file data sources, see “Connecting Using File Data Sources” in Chapter 6, “Connecting to a Data Source or Driver,” or the SQLDriverConnect function reference, in the ODBC Programmer’s Reference.
Modifying Data Sources
Depending on your requirements, you may find it necessary to reconfigure your data sources. The ODBC Administrator makes it easy.
To modify a data source
-
Make sure the ODBC Administrator is running. (See “Running the ODBC Administrator.”)
-
On the User DSN, System DSN, or File DSN tab, select the data source you want to modify, and then click Configure. A driver-specific Setup dialog box appears. Because each driver is different, each data source requires a slightly different configuration. Therefore, each data source has a unique Setup dialog box. For detailed information about the options in a data source Setup dialog box, click Help in the dialog box.
-
Modify the data source information, such as its name and file version (for example, dBASE III or dBASE IV), then click OK. The driver-specific Setup dialog box disappears.
-
(Optional) If you want to modify more data sources, repeat steps 2 and 3.
-
To close the ODBC Administrator, click Cancel.
Deleting Data Sources
To delete a data source
-
Make sure the ODBC Administrator is running. (See “Running the ODBC Administrator.”)
-
On the User DSN, System DSN, or File DSN tab, select the data source you want to delete, then click Remove.
-
From the message box that asks you to confirm removing the data source you have selected, click Yes to delete the data source, or No to return to the Data Sources dialog box without deleting the data source.
-
Repeat steps 2 and 3 until you have finished deleting data sources.
-
To close the ODBC Administrator, click Cancel.