Creating A Data Source


Data sources must be created on the computer actually running ColdFusion. If you are developing using a local ColdFusion installation, the data sources will be local, too; but if you are developing against a remote server, the data sources will need to be defined on that remote server.

There are two ways to create data sources, and I'll walk you through both:

  • Directly from within Dreamweaver

  • Using the ColdFusion Administrator

NOTE

If you haven't yet installed the sample file and databases, see the end of Appendix A, "Installing ColdFusion and Dreamweaver."


Creating a Data Source From Within Dreamweaver

The simplest way to create a new data source is by using the Dreamweaver extensions provided with ColdFusion. Assuming the extension is installed, here are the steps to perform:

1.

Open Dreamweaver, if it's not already running.

2.

Open the Application panel and select the Databases tab as seen in Figure 6.1.

Figure 6.1. Dreamweaver lists available data sources in the Application panel's Databases tab.


TIP

The Dreamweaver Application panel is annoyingly useable only when a file is actually open. If nothing is shown in this panel, be sure to open a .cfm file in the site (for example, sql.cfm in the sql folder).

3.

If you are prompted for the RDS Login, click on the link and provide the password (the one you specified during ColdFusion installation).

4.

Click the plus (+) button to display the data source types as seen in Figure 6.2, and select Microsoft Access Connection to display the Microsoft Access Connection dialog seen in Figure 6.3.

Figure 6.2. Click the + button to list available data source types.


Figure 6.3. Each data source has its own configuration screen.


5.

Enter ows as the name for the new data source in the CF Data Source Name field, and provide the full path to the ows.mdb file in this field (it usually is \ows\data\ows.mdb under the Web root) in the Database File field.

6.

Click OK to create the new Data Source. If all works well, you will see the new data source listed in the Application panels Databases tab as seen in Figure 6.4.

Figure 6.4. Newly created data sources will appear in the Application panel's Databases tab.


NOTE

If Dreamweaver is unable to create the data source for any reason, just use the ColdFusion Administrator option described next.


Creating a Data Source Using The ColdFusion Administrator

If you can't use the Dreamweaver extensionsor you prefer the Web interfaceyou can use the ColdFusion Administrator to define (and maintain) data sources. Here are the steps to perform:

1.

Log into the ColdFusion Administrator as described in Chapter 3, "Accessing the ColdFusion Administrator".

2.

Select the Data Sources menu option (it's in the section labeled Data & Services). You'll see a screen like the one in Figure 6.5, though with your own available data sources.

Figure 6.5. The Data Sources screen lists all available data sources.


3.

All defined data sources are listed in this screen, and they can be added and edited here as well. At the top of the screen, enter ows as the name for the new data source and set the driver type to Microsoft Access (as shown in Figure 6.6); then click the Add button.

Figure 6.6. Data sources can be defined (and edited) from within the Data Sources screen.


4.

The Data Source definition screen, shown in Figure 6.7, prompts for any information necessary to define the data source. The only field necessary for a Microsoft Access data source is Database File, so provide the full path to the ows.mdb file in this field (usually \ows\data\ows.mdb under the Web root). You also can click the Browse Server button to display a tree control created using a Java applet that can be used to browse the server's hard drive to locate the file interactively (as shown in Figure 6.8).

Figure 6.7. The Data Sources screen varies based on the driver selected.


Figure 6.8. Files may be located interactively using the Java applet file browser.


5.

When you have filled in any required fields, click the Submit button to create the new data source. The list of data sources will be redisplayed, and the new ows data source will be listed with a status of OK. The screen will report that the data source was successfully updated (Figure 6.9). If an error status message is returned (Figure 6.10), click ows to make any necessary corrections.

Figure 6.9. Newly created data sources are automatically verified, and the verification status is displayed.


Figure 6.10. If the data source can't be used, the status will indicate a failure.


NOTE

The options required in a data source definitions vary based on the driver used. As such, the screen used to create and edit data sources varies based on the driver used.




Macromedia Coldfusion MX 7 Web Application Construction Kit
Macromedia Coldfusion MX 7 Web Application Construction Kit
ISBN: 321223675
EAN: N/A
Year: 2006
Pages: 282

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net