Viewers: in countries Watching now:
In ColdFusion 9 New Features, author and developer Dan Short has gathered together the important updates and improvements in this dynamic web application. Dan showcases the new ColdFusion Builder application throughout the course, using it to work through the new language and CFScript enhancements in this release. He shows how to use the new Server Manager to compare servers and create server groups, as well as monitor server health through notifications. He also explains the new integration with Office applications, building Excel, Word, and even PowerPoint files on the fly from ColdFusion. Finally, he covers the important new Object Relational Mapping feature and how to use the built-in Flash Player. Exercise files accompany this course.
In this video, I'm going to show you two small but very powerful productivity
enhancements in ColdFusion 9,
being able to set a default data source and SMTP servers for an
What this means is that in my Application.cfc, I can specify a data source and an
SMTP server that get applied to all CF queries and
If I preview that, you can see it's dumping all of my artists to the page.
But it is a pain to always put the datasource attribute on every single CFQuery.
Normally, you get around this in ColdFusion 8 applications by storing that
value in some sort of application scope variable and applying that to every single CFQuery.
While that works, there's one more thing that you have to remember to add to
But if I go to my Application.cfc file, I can now into this scope set this.datasource equals cfartgallery. Now if I go back to default datasource.cfm and preview, I see all of my Artists once again. So, because this CFQuery didn't have a datasource attribute, it inherited it from the value specified in the Application.cfc. Now one thing to keep in mind is that the queries inherit the data source from the application that is calling them, not the application they actually live in.
To show you that, I have an ArtistService.cfc. Now this ArtistService does exactly the same as the other page. It just selects * FROM Artists and it does not have a data source specified. And then in my App2 folder, I have an Application.cfc and it currently has its datasource set to cfartgallery, and showArtists.cfm calls the ArtistService, gets all of the Artists and then dumps them to the page. This page works especially fine because in the Applications.cfc, I have set the datasource to cfartgallery Now if I change the datasource to cfbookclub, I should get an error because Artists table does not exist in the bookclub database.
So I'll go back to showArtists and run the page and we can see that the table, Artists, does not exist. So as you can see I called ArtistService, which is outside of the App2 application, but it did use the data source from this Application.cfc. So as you call external resources, remember that every file that you call is going to use the defaults from the calling application. So the SMTP servers work the same way. I am going to close a couple of files here and the only file I have left open is my Application.cfc here in Chapter2.
So I am going to open the smtpserversettings.cfm and as you can see,
I have a
Again, this is something where I would have to go through and every single
Now I've set this.smtpserversettings, I've specified my server, my username, and my password.
I'll save this file and go back to the test file and open that one and you see
I got a blank page and I switch over here and my email is already in my Gmail.
So while it was possible in ColdFusion 8 to wrap up your data source and SMTP server
settings in the application variables,
you still had to be cognizant of each and every query and
In ColdFusion 9, you can just set them in your Application.cfc and only think about them when you need to step outside of the normal operating procedures.
There are currently no FAQs about ColdFusion 9 New Features.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.