Connecting to an ODBC Data Source

When you use the Export To Database or Link To ODBC Database command for the first time, you must set up and select an ODBC data source. Although you can use the Control Panel to set up an ODBC data source before exporting or linking, you don’t have to—Visio 2007 provides all the options you need. A data source is simply the particular database file you want to connect to. You need to tell Visio 2007 where to find the database program, as well as which ODBC drivers can communicate with it and which database file (or object) to use. Through this process, you create a file called a data source name (DSN), which saves the settings used to create the connection.

You can create different types of DSNs depending on whether you want to share the connection with other users. The following procedure creates a file-based DSN, which means the DSN is portable—you can copy it to any other computer, such as a laptop or another user’s computer. For added security, you can also specify a user or system DSN, both of which limit access to the DSN file to the user of your computer.

Note

The following procedure assumes that a data source already exists. If you are creating a new DSN and a new database or spreadsheet, you must first create the database or spreadsheet file and save it before proceeding.


Follow these steps to create a new ODBC data source:

1.
Choose Tools, Add-Ons, Visio Extras, Export To Database or choose Tools, Add-Ons, Visio Extras, Link To ODBC Database.

2.
Click Create.

3.
Select the File Data Source (Machine Independent) option, and then click Next.

4.
In the list of ODBC drivers under Name, select the driver for the database you want to connect to, and then click Next.

Note

If you’ve learned how to create connection strings, as for example when connecting to a Microsoft SQL Server database, you can click Advanced, and then type the DSN parameters you want to use.

5.
Type a filename (with a .dsn extension) for or browse to the DSN file. It’s a good idea to indicate the program and database name. For example, if your data source is an Excel workbook with employee information, type a name such as Excel-Employee. DSN files are saved to a default system location, so you don’t have to click Browse to specify a folder location unless you want to store the DSN file in another place.

6.
Click Next to display a summary of your choices. Click Finish. Based on the ODBC driver selection you made in step 4, Visio 2007 displays a dialog box that contains driver-specific options for setting up the database program.

  • If you’re connecting to Excel, specify the version, and then click Select Workbook to locate and select the particular file (.xls or .xlsx) you want to connect to; clear the Read Only check box, and then click OK, and then click OK again to return to the dialog box from step 1. (If the Select Data Source dialog box appears, select the DSN file you just created and click OK.)

  • If you’re connecting to Access, click Select to locate the specific database file (.mdb or .accdb) that you want to use, and then click OK, and click OK again to return to the dialog box from step 1. (If the Select Data Source dialog box appears, select the DSN file you just created and click OK.)

  • The options for other databases are similar to the options for Access and Excel.

7.
In the Export To Database or Link To Database dialog box, the DSN you created is listed in the Name drop-down list. After you select your DSN the tables contained in your data source are listed in the Table list box. If you don’t see your DSN in the Name drop-down list, click Browse to select the DSN.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset