A ColdFusion MX Overview

As we have pointed out in earlier chapters, ColdFusion MX is the intermediary between the database and the dynamic web page. Still, for the average developer first approaching ColdFusion, it is quite an unfamiliar "application." We put the word "application" in quotation marks because, in actual fact, the entryway into ColdFusion is not through double-clicking an application icon. It is through a browser.

ColdFusion MX will run natively on Windows and various Unix servers, such as Solaris and HP-UX. It also runs on various J2EE platforms. Also, contrary to popular belief, ColdFusion MX does run on both a Macintosh and a PC. Though we discuss how ColdFusion MX can be installed to run on a Macintosh, a complete walkthrough will be supplied through the book's web site.

ColdFusion MX consists of two major components. They are the ColdFusion Markup Language (CFML) and the ColdFusion MX server software found on the Studio MX 2004 Install disc. Just be aware that the Studio includes a developer version of ColdFusion MX for local testing, not the "industrial strength" version offered by an ISP.

The ColdFusion Markup Language is a tag-based language, and if you are familiar with HTML, it won't be "foreign." ColdFusion tags are used to embed commands and functions into your Dreamweaver pages. In addition, CFML integrates quite nicely with other programming languages and components, such as Java servlets and classes.

CFML tags and functions can work alone and are usually mixed in with the other code on your page. These documents are sometimes referred to as ColdFusion templates?the extension is .cfm?and they can be created quite easily in Dreamweaver by opening a ColdFusion Template from the New Document menu.

The ColdFusion server works either as a standalone server on a PC or in conjunction with your web server. Any browser requests for .cfm documents are automatically handed over to the ColdFusion server, either by the web server or directly from the browser using a designated port. It then looks through the file for functions and tags and outputs the results in HTML directly or through the web server. This means the document can be understood and rendered on the user's screen through the open browser.

Note

Macromedia has updated ColdFusion MX. The current version is 6.1. If you own version 6, packaged with the MX Studio, you are entitled to a free upgrade. Details can be found at http://www.macromedia.com/software/coldfusion/.


Configuring ColdFusion MX

ColdFusion MX is a breeze to install. If you are using a PC, simply run the installer. ColdFusion MX can be installed as a standalone application (in which you would use port 8500 to test your apps) or as part of the web server. In this situation, you will be using either IIS (Internet Information Management Services) or Apache. Apache is an open source application and can be downloaded at http://www.apache.org/.

When ColdFusion MX is installed, you will be asked to define an Administrator password, as well as an RDS (Remote Development Server) password. For development purposes, we are using the same password for the admin and the RDS password. If you are using your machine as a development platform, using the same password for the ColdFusion MX Administrator and RDS is not a huge issue. Having done that, you are good to go.

Note

Never use your Admin password for development when you are online. Do that, and you are essentially offering any and all programmers free access to your ColdFusion MX server.


ColdFusion MX on a Mac? Why Not!

Using ColdFusion MX on a Macintosh is one of those things the ColdFusion MX development community can't quite comprehend. In fact, ColdFusion MX runs quite nicely if you are using Mac OS X Jaguar or Panther and have FreeBSD Unix utilizing Java 1.4.1. (FreeBSD is open source and can be downloaded from http://www.freebsd.org/.)

Mac OS X 10.2.x or greater supports standard J2EE servers, such as JRun 4 and Tomcat. ColdFusion MX runs over either of the above servers. In fact one of the authors?Jordan?has it configured to run over Tomcat.

Note

The authors were presenting at a recent conference, and one of the organizers casually mentioned in front of the attendees that ColdFusion simply doesn't run on a Macintosh. Jordan's response was, "Not so fast." He then opened his Macintosh in front of the attendees and launched ColdFusion on his Macintosh Portable. The audience response, to say the least, was a sharp intake of breath.


Why would you want to run ColdFusion MX over J2EE? The short answer is Java servlets and JSP modules can be called as if they are a part of ColdFusion. This provides you with increased flexibility for more powerful web applications that are well beyond the scope of this book.

To run ColdFusion MX on a Mac, you first need to install either one of the two mentioned JSP servers.

Note

ColdFusion MX was built to install over JRun. If you are new to developing web applications, you are best off using a developer version of JRun for your JSP. JRun also has all the necessary database drivers for hooking up to MySQL. However, if you decide to use Tomcat, carefully follow Macromedia's installation instructions outlined on their support site. In addition, if you use Tomcat, it is best to follow Apple's support instructions on their Developer web site (http://developer.apple.com) for installing and testing Tomcat. You will also need to add the MySQL JDBC drivers to Tomcat. For the proper JDBC drivers, you will have to check out http://jakarta.apache.org.


When you have installed your JSP server, you can proceed to install ColdFusion MX and supply the Admin and RDS passwords.

Following installation, you will be asked for an admin and an RDS password. For development purposes, we are using the same password.

Going Online with ColdFusion MX

Connecting ColdFusion MX to the Oakbridge database created earlier in the chapter is a relatively straightforward process. The first thing to do is to start up the ColdFusion MX application. If you are on a Macintosh and using ColdFusion MX over J2EE, ColdFusion MX will start automatically when your JSP server starts. To have ColdFusion MX manage the Oakbridge database, follow these steps:

  1. Launch your web browser and navigate to your ColdFusion MX Administrator page. This entry location will vary, depending upon which platform you are using. The Windows entry point is found in the Start menu (Start/All Programs/ Macromedia ColdFusion MX/Administrator). On the Mac, enter a URL similar to http://your-computer.local:8080/cfusion/ and you will be redirected to the administration area.

  2. Enter your Admin password and click the login button. If you entered the correct password, you will find yourself in the ColdFusion MX Administrator page.

  3. On the left side of the page is an area named Data and Services. Click on Data Sources. This will open the Data Sources page, which is where you add the Oakbridge database.

  4. In the Add New Data Source dialog box, enter Oakbridge in the Data Source Name text box. For our driver, select MySQL from the pop-down list. If your screen resembles Figure 8.5, click the Add button.

    Figure 8.5. The Data Source and the driver are identified in the ColdFusion MX Data Source page.

    graphics/08fig05.jpg

  5. From the Data Source window, you will be taken to the MySQL Data Source window. This is where you will enter the database information. Enter these values:

    • Database: oakbridge.

    • Server: localhost. (Don't change the port number?that is the default port used to connect to MySQL. If you did an easy installation of MySQL, the port number will not have changed.)

    • Password: For development purposes on your own machine, it will be okay to use your administrative username and password. However, if you are going to use your root password, ensure that you are not deploying any databases on that particular MySQL server. Otherwise, there is a high chance that your entire MySQL server could be hijacked through the Oakbridge database. Enter your username and password in the appropriate text boxes.

    • Description: This is optional (enter one for your own reference if you desire).

  6. If your Data Source window resembles Figure 8.6, click the Submit button. You will be returned to the Data Source page. If the status is OK, you have successfully connected your database, which will be indicated at the top of the page, and Oakbridge will be in the list of data sources at the bottom of the page. If your status is Error, you will need to retrace your steps. You can now quit ColdFusion MX.

    Figure 8.6. The Oakbridge database is identified as a data source in ColdFusion MX.

    graphics/08fig06.gif



     
    ASPTreeView.com
     
    Evaluation has ЦЛіМЪ№µДРexpired.
    Info...