Chapter 14: Handling Errors and Exceptions using ColdFusion MX


Instructions for Project Execution

This section describes the detailed instructions to execute the application code provided with this book.

Steps to Create the Database

Perform the following steps to create the database:

  1. Choose Start, Programs, Microsoft SQL Server, Query Analyzer. The Connect to SQL Server dialog box appears.

  2. Provide the name of the SQL server. Provide the user authentication information and click OK.

  3. Ensure that you are connected to the Master database. If you are not connected to the Master database, select it from the Database drop-down list.

  4. Chose File, Open.

  5. In the Open Query File dialog box, select Recruitment_database.sql. This script creates the RecruitmentApp database. If the SQL server is installed in C:\, you do not need to modify the script. If the SQL server is installed in any other path, modify the database path in the script.

  6. Click the Execute button on the toolbar to execute the Recruitment_database.sql script. This creates the database.

Perform the following steps to create the tables Applicants, Applicants_Skills, Logins, and Skills:

  1. In the Query Analyzer, open the RecruitmentApp_Tables .sql script. Ensure that when this script is executed, the current database is RecruitmentApp.

  2. Run the script. The RecruitmentApp_Tables .sql script creates the tables in the RecruitmentApp database.

Perform the following steps to insert the data in the tables:

  1. In the Query Analyzer, open the RecruitmentApp_masterdata .sql script. Ensure that when this script is executed, the current database is RecruitmentApp.

  2. Run the script. The RecruitmentApp_masterdata .sql script inserts data in the Skills and Logins table in the RecruitmentApp database.

The login that the script creates by default is user1 and the password is userone.

Steps to Test the Application in ColdFusion MX

Create the data source as follows:

  1. Start Cold Fusion MX Administrator. This is usually located at http://localhost/CFIDE/Administrator/index.cfm, but the location can be different as per the setup.

  2. Provide the password. The main screen appears.

  3. Navigate to data sources under the Data and Services section.

  4. Create a data source named Recruitmentapp for SQL Server.

Test the application as follows:

  1. Create a directory named ProjectThree under the wwwroot directory on the Web server.

  2. Copy all the .cfm files in the ProjectThree directory.

  3. Start the browser and open the login.cfm page (http://hostname/ProjectThree/login.cfm).

No matter how foolproof you make an application, some bugs are bound to crop up and display system-defined messages, which aren't user-friendly. Sometimes an application might fail due to factors beyond your control, such as problems related to hardware, network operating software, networking, database connections, and so on.

Errors can give away useful information, such as server path, filename, and table name, to malicious end users who can use this information to download files and damage data. This can cause considerable loss to your organization.

Handling errors and exceptions allows you to catch errors, notify users of errors, and recover from error conditions in an efficient manner. Properly handled errors reflect the quality of the product. By default, ColdFusion generates its own error messages. An end user usually doesn't understand system-defined error messages. This justifies the need for custom-defined error messages.

In this chapter, you'll learn how to identify and recover from error conditions, and how to notify the end user about this by displaying meaningful error messages. ColdFusion offers many tools and techniques for responding to the errors that your application encounters, including error handling mechanisms and error logging tools. This chapter covers tags such as <cftry>, <cfcatch>, <cfthrow>, <cfrethrow>, <cferror>, and <cftrace>. You'll also learn how to set up error and exception handling at the server level.




Macromedia ColdFusion MX. Professional Projects
ColdFusion MX Professional Projects
ISBN: 1592000126
EAN: 2147483647
Year: 2002
Pages: 200

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