Learn the powerful enterprise adaptable database:

Getting Started With ADABAS & Natural

Thursday, June 20, 2013

ColdFusion and DreamWeaver

Copied from: http://www.adobe.com/devnet/dreamweaver/articles/setup_cf.html
----------

User level

Beginning

Required products

Sample files

This article describes how to set up a development environment on a Windows or Mac computer for ColdFusion web applications with Adobe Dreamweaver CS5. Adobe ColdFusion 9 Developer Edition can be downloaded free of charge for developing and testing web applications on your local computer. You can use it to develop and test your web applications as long as you want; the software does not expire.
Setting up a development environment for Dreamweaver is a three-part process. First, you set up an Adobe ColdFusion application server. Separate instructions are given for Windows and Mac OS X. Second, you define a Dreamweaver site. Third, you connect to your database. This article follows this three-step process.
Note: Adobe does not provide technical support for third-party products such as database systems.

Setting up ColdFusion on Windows

This section describes how to install the developer edition of ColdFusion 9 on Windows. If you are using Mac OS X, skip toSetting up ColdFusion on Mac OS X.
  1. Visit the ColdFusion download page on the Adobe site. To gain access, you need to enter your Adobe ID and password. If you don't have an Adobe ID, click the button to create an Adobe account and follow the onscreen instructions.
  2. Select the appropriate version of the ColdFusion 9 Developer Edition. Make sure you choose the correct one for your operating system–there is a separate version for 64-bit versions of Windows. Click Download.
  3. Log into Windows using an administrator account. Close all other programs, double-click the ColdFusion 9 installer file, and follow the onscreen instructions.
  4. When prompted to choose the type of installation (see Figure 1), select Developer Edition. This allows you to install ColdFusion 9 and run it indefinitely.
Select Developer Edition when prompted for the type of installation.
Figure 1. Select Developer Edition when prompted for the type of installation.
  1. In the Installer Configuration screen (see Figure 2), select the Server Configuration option.
Select the Server configuration option.
Figure 2. Select the Server configuration option.
  1. Accept all the defaults in the Subcomponent Installation screen (see Figure 3).
Accept the default options in the Subcomponent Installation screen.
Figure 3. Accept the default options in the Subcomponent Installation screen.
  1. In the Select Installation Directory screen, accept the default location, C:\ColdFusion9.
  2. In the Configure Web Servers/Websites screen (see Figure 4), select Built-in Web Server (Development Use Only).
Select the built-in web server option.
Figure 4. Select the built-in web server option.
  1. When prompted, create a password for the ColdFusion administrator. Make a note of this password, or choose something you can remember, as you will need it to configure ColdFusion later.
  2. In the Enable RDS screen (see Figure 5), select Enable RDS, and then type and confirm a password. This does not need to be the same as the ColdFusion administrator password you created in the previous screen. However, for a development environment, it is simpler to use the same one.
Enabling RDS is essential for a development server.
Figure 5. Enabling RDS is essential for a development server.
  1. The installer presents you with a summary of the options you have chosen, and then installs ColdFusion 9. At the end of the installation process, you should see a confirmation screen (see Figure 6).
The installer confirms that ColdFusion 9 has been installed.
Figure 6. The installer confirms that ColdFusion 9 has been installed.
  1. To complete the installation process, you need to log into the Configuration Wizard. By default, the check box to launch the wizard in your usual browser should already be selected. Click Done.
  2. When your browser launches, enter your ColdFusion Administrator password, and click OK.
  3. The next screen informs you that the ColdFusion server is being configured. Be patient. This can take several minutes.
  4. When the wizard reports that it has finished, click OK. You should see the ColdFusion Administrator screen (see Figure 7).
The welcome screen confirms that the ColdFusion server is running.
Figure 7. The welcome screen confirms that the ColdFusion server is running.
To learn more about the ColdFusion Administrator, see Administering ColdFusion in the ColdFusion documentation.
The next section covers installation on Mac OS X. Skip to Setting up a ColdFusion site in Dreamweaver CS5.

Setting up ColdFusion on Mac OS X

These instructions are for Mac OS X. Installation instructions for Windows users are in the previous section. If you have already installed ColdFusion 9, proceed straight to the next section.
The Mac installation process asks you to confirm that you don't already have a ColdFusion 9 server on your computer (if you do, it will be located in Applications/ColdFusion9). If you have an earlier version of ColdFusion on your computer, you will be asked if you want to migrate the settings to ColdFusion 9.
  1. Visit the ColdFusion download page on the Adobe site. To gain access, you need to enter your Adobe ID and password. If you don't have an Adobe ID, click the button to create an Adobe account and follow the onscreen instructions.
  2. Select the appropriate version of the ColdFusion 9 Developer Edition. Make sure you choose the correct one for your operating system–there is a separate version for Macs that are 64-bit capable. Click Download.
  3. Check that you are logged into your Mac using an administrator account. Close all other programs, launch the ColdFusion 9 disk image, and follow the onscreen instructions.
  4. When prompted to choose the type of installation (see Figure 8), select Developer Edition. This allows you to install and run ColdFusion 9 indefinitely.
Select Developer Edition when prompted for the type of installation.
Figure 8. Select Developer Edition when prompted for the type of installation.
  1. In the Installer Configuration screen (see Figure 9), select the Server configuration option.
Select the Server Configuration option.
Figure 9. Select the Server Configuration option.
  1. By default, the Subcomponent Installation screen (see Figure 10) selects the option to start the ColdFusion server automatically when your computer starts up. This is the most convenient method of using ColdFusion for local development. However, deselect this option if you prefer to start ColdFusion manually.
Accept the default options in the Subcomponent Installation screen.
Figure 10. Accept the default options in the Subcomponent Installation screen.
  1. In the Select Installation Directory screen, accept the default location, Applications/ColdFusion9.
  2. If you have an older version of ColdFusion on your computer, you are given the option to migrate the settings. If you don't have an older version, select No before moving to the next screen.
  3. In the Configure Web Servers/Websites screen (see Figure 11), select Built-in Web Server (Development Use Only).
Select the Built-in Web Server option.
Figure 11. Select the Built-in Web Server option.
  1. When prompted, create a password for the ColdFusion administrator. Make a note of this password, or choose something you can remember, as you will need it to configure ColdFusion later.
  2. In the Enable RDS screen (see Figure 12), select Enable RDS, and then type and confirm a password. This does not need to be the same as the ColdFusion administrator password you created in the previous screen. However, for a development environment, it is simpler to use the same one.
Enabling RDS is essential for a development server.
Figure 12. Enabling RDS is essential for a development server.
  1. If you selected the option to start ColdFusion automatically when your computer starts up, you will be prompted to enter your Mac administrator password.
  2. The installer presents you with a summary of the options you have chosen, and then installs ColdFusion 9. At the end of the installation process, you should see a confirmation screen (see Figure 13).
The installer confirms that ColdFusion 9 has been installed.
Figure 13. The installer confirms that ColdFusion 9 has been installed.
  1. To complete the installation process, you need to log into the Configuration Wizard. By default, the checkbox to launch the wizard in your default browser should already be selected. Click Done.
  2. When your browser launches, type your ColdFusion Administrator password, and click OK.
  3. The next screen informs you that the ColdFusion server is being configured. Be patient. This can take several minutes.
  4. When the wizard reports that it has finished, click OK. You should see the ColdFusion Administrator screen (see Figure 14).
The welcome screen confirms that the ColdFusion server is running.
Figure 14. The welcome screen confirms that the ColdFusion server is running.
To learn more about the ColdFusion Administrator, see Administering ColdFusion in the ColdFusion documentation.

Setting up a ColdFusion site in Dreamweaver CS5

Once you have installed ColdFusion, you're ready to start developing ColdFusion pages and applications in Dreamweaver. In order to display your pages in Live view or Preview In Browser, the dynamic code needs to be processed by the ColdFusion server. This means storing your pages inside the server's document root. If you followed the instructions in the preceding pages, the document root will be at the following location:
  • Windows: C:\ColdFusion9\wwwroot
  • Mac OS X: Applications/ColdFusion9/wwwroot
Note: Strictly speaking, you can store your ColdFusion files anywhere on your computer, but they need to be copied to the ColdFusion server whenever you view them. So, it's common practice to store them inside the document root in the first place. This avoids cluttering your hard disk with duplicate files.
Instead of accessing the files directly, you need to use a URL. The URL for the ColdFusion document root ishttp://localhost:8500/ or http://127.0.0.1:8500/. Both represent the same place: localhost is an alias for 127.0.0.1, the loopback IP address meaning this computer. The :8500 indicates the port used by a ColdFusion development server.
If you locate all your files in the wwwroot folder, you can create only one site. So, it's usually more efficient to develop your ColdFusion sites in a subfolder of wwwroot. You add the name of the subfolder to the end of the URL in the same way as you would for a subfolder in a live website. For example, if you create a site in a subfolder called cftest, the URL becomes http://localhost:8500/cftest/.
  1. Download the sample files for this article (the link is on the first page), and unzip them.
  2. Create a new folder called cftest in the ColdFusion server document root. In Windows, the folder will beC:\ColdFusion9\wwwroot\cftest. On a Mac, it will be Applications/ColdFusion9/wwwroot/cftest.
  3. Copy the sample files into this folder. You should have three subfolders called _notesassets, and data, and a file called comments.cfm (see Figure 15).
Place the sample files in a subfolder of the ColdFusion server's document root.
Figure 15. Place the sample files in a subfolder of the ColdFusion server's document root.
  1. In Dreamweaver CS5, select Site > New Site.
  2. In the Site Setup dialog box, type ColdFusion Test as the Site Name.
  3. Click the Browse for Folder icon to the right of the Local Site Folder, navigate to the cftest folder in the ColdFusion server document root, and select it. On Windows, Local Site Folder should display C:\ColdFusion9\wwwroot\cftest\(see Figure 16). On a Mac, it should be /Applications/ColdFusion9/wwwroot/cftest.
Create the basic site definition in Dreamweaver CS5.
Figure 16. Create the basic site definition in Dreamweaver CS5.
  1. You don't need to define the testing server for a site until you're ready to start testing, so you could click Save at this point. However, since you're going to test the site immediately, select Servers from the list on the left of the Site Setup dialog box.
  2. Click the plus (+) button at the bottom left of the Servers panel to add a new server.
  3. With the Basic button selected at the top of the dialog box that opens, select Local/Network from the list of Connect Using options. Although there is also an RDS option, using Local/Network is quicker and easier when working with a local development server.
  4. Give the server a name, such as Local Testing.
  5. Set the Server Folder text field to the same value as you used for Local Site Folder. On Windows, this isC:\ColdFusion9\wwwroot\cftest\, and on a Mac, /Applications/ColdFusion9/wwwroot/cftest.
  6. Type the URL for the testing server in the Web URL text field (see Figure 17). On both Windows and Mac, this ishttp://localhost:8500/cftest/.
Specify the basic settings for the testing server.
Figure 17. Specify the basic settings for the testing server.
  1. Click Advanced at the top of the dialog box. For the Server Model select ColdFusion (see Figure 18), and click Save.
Set the Server Model option to ColdFusion.
Figure 18. Set the Server Model option to ColdFusion.
  1. Make sure the Remote check box is deselected and the Testing check box is selected (see Figure 19), and click Save to complete the site and testing server setup.
Make sure the Testing checkbox is selected.
Figure 19. Make sure the Testing check box is selected.
The Dreamweaver site is now defined and the sample files installed. The next step is to connect to the sample database included in the sample files.

Connecting to a database

This section describes how to create a connection to a sample database. The sample files you copied in the previous section include an embedded Derby database. Derby is supported in all operating systems that ColdFusion supports and is therefore a great solution for cross-platform development.
When developing a ColdFusion web application in Dreamweaver, you connect to a database by selecting a ColdFusion data source defined in ColdFusion Administrator, the server's management console. A ColdFusion data source is a type of shortcut to a database. Dreamweaver uses the data source to create a connection to the database.
For information on connecting to other database systems, see Database connections for ColdFusion developers (link to DW CS5 help page) in the Dreamweaver online help.

Create a ColdFusion data source

To create a ColdFusion data source, follow these steps:
  1. First, you need a ColdFusion page open in the Dreamweaver Document window. Although the sample files containcomments.cfm, it contains a reference to a data source that doesn't yet exist. So select File > New, and create a blank ColdFusion page. There's no need to save it, because it will be deleted once the data source has been established.
  2. Choose Window > Databases to open the Databases panel (or press Ctrl+Shift+F10 on Windows or Shift+Cmd+F10 on Mac OS X). There should be check marks against the first three items. The next stage is to specify the RDS login information for the ColdFusion server. Click the link in item 4 (see Figure 20).
Set the RDS login information for the ColdFusion server.
Figure 20. Set the RDS login information for the ColdFusion server.
  1. In the dialog box that opens, type admin as the User Name.
  2. Type the RDS password you created for the ColdFusion administrator as the Password, and click OK.
  3. Click the data source link in item 5. If it's no longer visible in the Databases panel, switch to the Bindings panel, and click the data source link there. This launches the ColdFusion Administrator in your default browser. Enter your ColdFusion administrator password if necessary.
    The ColdFusion Administrator should open automatically in the Data Sources screen. If it doesn't, select the Data Sources link in the left sidebar.
  4. In the Data Source Name text box, type connTownsend (no spaces).
  5. Select Apache Derby Embedded from the Driver list.
  6. Click Add.
  7. Click the Browse Server button next to the Database File text box, and then locate and select the conntownsend2folder.
    The folder should be located in the following folder:
    \ColdFusion9\wwwroot\cftest\data\conntownsend2
    Ensure that Create Database is not selected.
  1. Click Submit to accept your choices.
  2. In Dreamweaver, click the Refresh icon at the top right of the Databases panel (see Figure 21) to display the database connection. Expand the connTownsend branch and then the Tables branch to show three tables.
Click refresh and expand the tables in the Databases panel.
Figure 21. Click refresh and expand the tables in the Databases panel.
  1. Close the blank ColdFusion page, and open comments.cfm in the Document window.
    The central section contains dynamic text objects highlighted in light blue (see Figure 22).
The sample page contains ColdFusion dynamic text objects.
Figure 22. The sample page contains ColdFusion dynamic text objects.
  1. Click Live View. Dreamweaver connects to the database through the ColdFusion server, and displays the results from the database (see Figure 23).
In Live view the page is populated with data drawn from the database.
Figure 23. In Live view the page is populated with data drawn from the database.
To learn more about creating web applications with ColdFusion, visit the Getting Started page in the ColdFusion Developer Center.

No comments:

Post a Comment