Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe ColdFusion

Introducing ColdFusion 9

ColdFusion 9 boasts an impressive array of new and enhanced features, all intended to improve productivity for developers, IT administrators, and business decision makers alike. In this article, Ben Forta introduces you to some of what’s new and exciting in ColdFusion 9.
Like this article? We recommend


For close to a decade and a half, ColdFusion has constantly raised the application development productivity bar with each new release. This does not happen by accident. In fact, in planning each new version, the ColdFusion product team meets with numerous customers and partners to ascertain exactly how the product is used, so as to be able to focus on improvements that have real value for users. This is how innovative features like reporting and event gateways and server monitoring become a reality.

And ColdFusion 9 is no exception. This new ColdFusion boasts an impressive array of new and enhanced features, all intended to improve productivity for developers, IT administrators, and business decision makers alike. In fact, to cover all of ColdFusion 9 you’d need a book (or perhaps 3 books!). But, in this article I’d like to introduce you to some of what’s new and exciting in ColdFusion 9.

ColdFusion Functionality Exposed As Services

Have you ever stopped to think about just how much functionality is baked into ColdFusion? We use <CFQUERY> to work with databases, allowing for highly flexible and dynamic SQL as well as query caching and more, and this is powered by a sophisticated internal engine. We use tags like <CFCHART> and expect charts to be generated and displayed, without every really paying attention to the fact that an entire Java based charting engine is built in and actually doing the heavy lifting. The same is true for <CFPDF>, <CFIMAGE>, <CFSEARCH>, support for SOAP and Web Services, XMPP and JMS integration, and so much more. While most of us focus on CFML the language, the truth is that the bulk of ColdFusion, the majority of what gets installed, is not the language but the extensive array of integrated services, services that are exposed to ColdFusion via CFML tags and functions.

But what if these services could be accessed outside of ColdFusion? If a PHP developer in the next cube over needed to merge PDF files, why couldn't he invoke ColdFusion's PDF manipulation services? If a .NET developer needed to access Microsoft Exchange, why couldn't she use ColdFusion's brilliant Exchange tags (rather than having to write lots and lots of .NET code, and I do mean lots and lots)? What about the Java developer who needs to easily manipulate spreadsheet files without tinkering with low level libraries?

And while we're at it, what about the Flex developer who needs to generate an e-mail message? Flex (well, Flash) has no built in SMTP libraries, and so Flex developers who need to programmatically generate e-mail messages do so by writing code on the server. For ColdFusion developers this means creating a ColdFusion Component which accepts data from a Flex application (likely via an AMF call) and then passes that same data to a <CFMAIL> tag. In other words, code is being written on the server just to be able to pass data from Flex on the client to the <CFMAIL> tag. So why couldn't a Flex developer just invoke <CFMAIL> directly, passing it name=value pairs so it can generate an e-mail?

Well, with the upcoming ColdFusion 9, the answer to all of these questions is yes, these are all doable! In ColdFusion 9 we're exposing lots of those integrated ColdFusion services via AMF (Flash Remoting) and SOAP (Web Services). The PHP, .NET, and Java developers can invoke ColdFusion built-in Web Services, pass in data, and get back results. And the Flex developer can include a ColdFusion SWC file exposing ActionScript classes and MXML tags via simple abstracted AMF calls. Simply include the SWC in your Flash Builder project, define the ColdFusion name space like this:

<mx:Application xmlns:cf="coldfusion.service.mxml.*">

and you'll have access to CFML tags within your Flex project. For example, to send an e-mail you could use the following:

<cf:Mail id="cfMail"
type="html" />

The above code creates an instance of the Mail object and names it "cfMail", and sets to, from, subject, etc., with the values of other Flex objects. To actually send the mail all you'd need is to invoke the following (possibly when a Send button is clicked):


There is much more to this "ColdFusion as a Service" functionality, including lots more services exposed, and a sophisticated security model.

But the bottom line is that ColdFusion is now poised to become even more valuable to Flex and AIR developers, and now even of value to developers using other platforms and languages.

Working With Spreadsheets In ColdFusion

Spreadsheets are key to just about all businesses and organizations, and ColdFusion developers have long sought a way to access and manipulate spreadsheet data programmatically. The truth is, ColdFusion has supported spreadsheet access for a while in a variety of ways, it's been possible to access Excel files from an ODBC driver, and it's been possible to generate these files using CFReport as well as by generating HTML or CSV content and then setting the appropriate MIME type to force the browser to display the data using Excel.

But ColdFusion developers have been asking for more, greater and more control, and the ability to read and write specific parts of spreadsheet files. And as I demoed in my usergroup presentations last week, this is indeed planned for ColdFusion 9.

Just like we did with the ColdFusion image manipulation functionality, spreadsheets in ColdFusion are manipulated using a tag or functions, or some combination thereof. The <CFSPREADSHEET> tag is used to read a sheet from a spreadsheet file (as a spreadsheet object, a query, a CSV string, or HTML), write sheets to XLS files, and add sheets to XLS files. The over 30 supporting functions like SpreadsheetSetCellValue(), SpreadsheetAddRow(), and SpreadsheetSetCellFormula() allow for more granular spreadsheet manipulation, and can be used in conjunction with supporting functions like SpreadsheetNew() to create a new spreadsheet object, and SpreadsheetInfo() which returns title, subject, sheet names, last saved date and time, and more.

Here are some of the examples I used at my presentations. This first example reads an entire spreadsheet as a query and dumps the contents:

<!--- Read spreadsheet --->

<cfspreadsheet action="read"
<cfdump var="#myQuery#">

<CFSPREADSHEET> is also used to write (or overwrite) a spreadsheet, as seen here:

<!--- Write spreadsheet --->
<cfspreadsheet action="write"
name="sObj" />

To update a specific cell, you need to read, update, and save, like this:

<!--- Read spreadsheet --->
<cfspreadsheet action="read"
name="sObj" />
<!--- Set cell value --->
<cfset spreadsheetSetCellValue(sObj, FORM.sales, FORM.row, FORM.col)>
<!--- Write spreadsheet --->
<cfspreadsheet action="write" overwrite="true"
name="sObj" />

<cfspreadsheet> and its 30+ supporting functions can do lots more, but this should give you a taste of just what's possible using this innovative new feature.

ORM – Rethinking Database Integration

Database integration is a hallmark of ColdFusion applications. Indeed, the <cfquery> tag was one of the first added to the language, and to this day remains ones of the most used. There is an inherent simplicity and flexibility to being able to create database queries on the fly, so as to be able to refer to column names to work with results. There's also a real downside to this type of database integration. After all, consider what would happen to your code if a table name changed, or if columns were refactored and split, or if whole schemas were updated. Scary, huh? The downside of how most of us integrate databases into our ColdFusion apps is that we tend to write database specific code even at the client level, the code generating output or working with form fields, for example. In addition, we inevitably must write DBMS specific SQL, and that DBMS specific code needs to be managed by our applications.

Before I go any further, I must point out that <cfquery> is not going away, and it remains a very simple and powerful database integration option. For many of us, and for many apps, is, and remains, highly appropriate. But, having said that, in ColdFusion 9 we're adding support for a newer way to think about database integration, leveraging Object Relational Mapping (ORM). ColdFusion's ORM support is built on Hibernate, the premier ORM implementation in Java development, and in fact, Hibernate is built right into the next version of ColdFusion, and exposed via ColdFusion Components and language elements.

ColdFusion's ORM support requires extensive coverage, and are way beyond the scope of this article, but here are the basics. In ORM, you never write SQL statements, and never really consider tables of rows and columns, at least not when writing client code. Instead, developers using ORM work with objects. For example, a table containing books with columns named title and author and ISBN, would have a corresponding object with the same properties. When using ORM, instead of retrieving a row from a table, you'd retrieve a book object (which is automatically populated by the contents of the table row). To retrieve all rows you'd not use a SELECT * FROM Books, instead you'd use Entity functions to request an array of book objects, populated and ready to use. And then instead of referring to column names in your code, you'd use Get methods in the returned objects. This is actually far less confusing than it sounds, so let's look at an example. First the Application.cfc:

    <cfset this.ormenabled=true>
    <cfset this.datasource="cfbookclub">

this.datasource is used to define the datasource to be used, and then this.ormenabled is set to TRUE to turn on ORM support.

Next we'll need an object that represents the table to be used, and in ColdFusion objects are implemented as ColdFusion Components (if you are working with multiple tables you'd have multiple CFCs, one for each table). Here's Books.cfc which maps to the Books table in the specified datasource:

<cfcomponent persistent="true">
    <cfproperty name="BOOKID" column="BOOKID" datatype="integer" length="10" />
    <cfproperty name="AUTHORID" column="AUTHORID" datatype="integer" length="10" />
    <cfproperty name="TITLE" column="TITLE" datatype="string" length="255" />
    <cfproperty name="BOOKDESCRIPTION" column="BOOKDESCRIPTION" datatype="clob" length="2147483647" />

    <cfproperty name="BOOKIMAGE" column="BOOKIMAGE" datatype="string" length="50" />
    <cfproperty name="THUMBNAILIMAGE" column="THUMBNAILIMAGE" datatype="string" length="50" />
    <cfproperty name="ISSPOTLIGHT" column="ISSPOTLIGHT" datatype="character" length="1" />
    <cfproperty name="GENRE" column="GENRE" datatype="string" length="50" />

Notice that there are no methods (functions) in this CFC, there are only <cfproperty> tags that correspond to the table columns. And actually, the <cfproperty> tags are optional, and if omitted ColdFusion will read the database table to implicitly define the properties for you! Also, note that the CFC is named Books.cfc, so it maps to the Books table. if the table name changed, or if you needed to use a different CFC name, you could use the optional <cfcomponent> table attribute to specify the table name to use.

Oh, and it's worth noting that new ColdFusion Builder (more on that in a moment) comes with wizards to generate these table CFCs for you.

And finally, here's how to retrieve the Books data. First we'll retrieve all books (this is equivalent to a SELECT *, but instead of returning a query, an array of Books objects is returned):

<!--- Get data --->
<cfset data=EntityLoad("Books")>
<!--- Display titles --->
<cfloop from="1" to="#ArrayLen(data)#" index="i">


Of course, sorting and filtering and more are all supported. For example, to retrieve books with an author id of 10 (equivalent to a SQL WHERE clause) you could use the following:

<!--- Get data --->
<cfset data=EntityLoad("Books", {authorid=10})>

Notice that to access the Title property, a GetTitle() method is used. This is a getter, and it is automatically created by ColdFusion. There are also setters, used to set properties within an object. To save a new or updated object you'd simple do the following:

<cfset EntitySave(data)>

This would work for an insert or an update, just save the object and ColdFusion and Hibernate figure out whether to update an existing row or insert a new one.

And we've even made it easier to bridge between using ORM and workign with queries (for example, to be able to use , and more), just use the EntityToQuery() function to convert basic arrays of entity objects to familiar ColdFusion queries.

There's a lot more to ORM and ColdFusion's Hibernate integration. And ColdFusion developers get access to all of Hibernate, be it support for relational tables, lazy loading, caching, query optimization (by tweaking HQL directly), controlling all ORM settings, and much more, too. ColdFusion 9 gives you the power of Hibernate with the productivity that is uniquely ColdFusion.

The Big News: ColdFusion Gets An IDE

If all of what we’ve looked at thus far were not enough, the next “feature” is probably the one that most excites ColdFusion developers. ColdFusion is getting its very own IDE, ColdFusion Builder. This new tool really needs an entire article unto itself, but here is a quick list of the important points to note:

  • ColdFusion Builder is built on Eclipse, the same platform which powers Flash Builder, and is actually designed to be installed along with Flash Builder for seamless integration.
  • ColdFusion Builder can work with local or remote servers, and can also stop / start / restart / manager / monitor those servers.
  • ColdFusion Builder features rich code coloring, context sensitive help, tag attribute help, and more.
  • ColdFusion Builder features toolbars with shortcuts for things like wrapping a block of code in<cfoutput> and more.
  • RDS is integrated, as is a debugger, a log file viewer, and more.
  • ColdFusion Builder has an integrated extensibility model which allows extensions to be written in CFML (instead of Java, the way Eclipse extensions are usually written). And numerous ColdFusion Builder extensions have already been posted to
  • ColdFusion Builder has been a long time coming, and we have big plans for how to further enhance it in the future.

Where to go from here

There’s a lot more to ColdFusion 9 beyond what I’ve covered here. From SharePoint and portal server integration, to important language enhancements, to support for offline AIR applications, and more, ColdFusion 9 is an extensive release chock full of powerful and useful features intended to make you more productive than ever before.

If you want to learn more about ColdFusion 9 and ColdFusion Builder, your best bet is to visit the Adobe ColdFusion page at

Ben Forta is Adobe Systems Inc.'s Director of Platform Evangelism, and is one of the best known and most trusted names in the ColdFusion community. Ben is the author of numerous books on ColdFusion, SQL, Regular Expressions, and related technologies, and 1/2 million Ben Forta books have been printed in more than a dozen languages worldwide. He is currently working on updating his bestselling series of books: ColdFusion 9 Web Application Construction Kit (Peachpit Press).

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive:

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020