Before you can connect to a database in Dreamweaver, you must create a ColdFusion data source in ColdFusion Administrator, the server's management console.

A ColdFusion data source is a one-word identifier, such as "Acme," that points to the database and contains all the information needed to connect to it. ColdFusion data sources are similar to Windows data source names (DSNs) in that they automatically include all the DSNs set up on the Windows system running ColdFusion. They're unlike DSNs in that you can create data sources for databases using OLE DB providers or native drivers. (DSNs can point to databases only if you're using ODBC drivers installed on a Windows computer). For more information, see Dreamweaver Help (Help > Using Dreamweaver > Appendixes > Beginner's Guide to Databases > Understanding database connections).

Now you'll define the Wildlife Project database as a ColdFusion data source.

1

In the Dreamweaver Site panel, select the Wildlife Project site that you created in the previous tutorial, Wildlife Project 6: Defining your Dreamweaver MX site. If you did not define a Dreamweaver site (local and remote) as well as a testing server for the Wildlife Project, you will need to do so before proceeding.

2

Create a new file by selecting File > New.

3

Select Dynamic Page from the Category column and ColdFusion from the Dynamic Page column of the General tab.

4

Click Create.

5

Save the file in the main directory of the Wildlife Project site (wildlife_project) as index.cfm.

6

Title the document by typing The Wildlife Project into the Title box at the top of the document.

Do not close the file. It needs to be open in the Document window for you to complete the next steps.

Log in to ColdFusion Administrator using the password that you selected when you installed your ColdFusion MX application server.

Once you've logged in, you'll see the Data Sources screen.

9

Type wildlife in the Data Source Name text field.

10

If you are using the Microsoft Access Wildlife Project database provided with this tutorial series, select Microsoft Access from the Driver pop-up menu. If you are using another type of database, select the appropriate driver from the driver pop-up menu.

Note: The screen will vary, depending on the driver you selected in step 10.

12

If you are using the Microsoft Access Wildlife Project database provided with this tutorial series, click the Browse Server button next to the Database File text field, and browse to the Microsoft Access database for The Wildlife Project. The database can be anywhere on the Windows system running the application server. For this tutorial, we've placed the database file wildlife.mdb in its own folder called "data," and placed that folder in the wwwroot directory of our Inetpub folder.

13

Click Apply.

ColdFusion Administrator populates the Database File field with the correct path to the database.

14

(Optional) Enter a description of the database in the Description text field.

15

Click the Submit button.

ColdFusion Adminstrator returns you to the Data Sources screen.

If you selected a valid database file path, and you have the correct drivers installed on your system, ColdFusion Administrator shows an OK status in the Status column of the Connected Data Sources window.

For more information, including information about connecting to data sources using Oracle, MySQL, and other drivers, see the ColdFusion Administrator documentation. You can access the ColdFusion Administrator documentation by clicking the Documentation link at the top of the ColdFusion Administrator screen.