Database Structure / Creating a ColdFusion Datasource
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.
Learn More
Subtitles of the Movie
After the database and tables are created, we'll need to tell Cold Fusion where to find them. This is accomplished by creating a data source name. A data source name is like an address, it describes a location so that a visitor can get there. Without a DSN Cold Fusion would wander aimlessly among databases without a clue about which to use. Because Cold Fusion MX uses the Java ODBC driver, a different set of procedures is required. And creating a DSN changed significantly from Cold Fusion 5.0 to Cold Fusion MX. Generally, it's more straight forward with MX to create a system DSN using the Windows operating system And then link to that DSN through an intermediary, then it is to try to create a DSN in Cold Fusion MX administrator. We'll use this method since I found that it works more consistently. First open the ODBC data source manager by clicking start, control panel, administrative tools, and data sources. Select the system DSN tab and then the add button. Select the SQL Server Driver and then finish. The name for this data source should be wherestom. I'm going to put in a description but a description isn't required. We'll select the local server, since I'm working with a local copy of SQL Server and then click next. For our local database, we can use our windows account authentication. So we'll leave that selected and click next. Click change the default database and a select list with the available databases will display. Choose wherestom and click next. When you click the finish button, a summary of the information is displayed. Be sure to click the test data source button at this point. It can be very useful to know now if the system won't accept the data source, rather than trying to make it work in Cold Fusion administrator. If the connection is unsuccessful, double check your login information. When you have connected successfully, click OK to go back to the data source manager. Next we'll add this data source to Cold Fusion administrator. Open Cold Fusion administrator by clicking Start, All programs, Macromedia, Cold Fusion MX, Administrator, and entering your password if you left it enabled. Under the menu item, data and services, click data sources. Enter wherestom in the data source name field and then select ODBC socket in the drop down. Click add and Cold Fusion will search the existing system data sources for one that matches the name you entered. If it doesn't find one, it just displays the list of available system data sources. Since we named our DSN wherestom and called our Cold Fusion data source wherestom, They should match up and the correct system DSN should be selected. Since we are connecting locally, and using the windows authentication, leave the user name as system and the password blank. Advanced settings allow you to change the characteristics of the Cold Fusion connection to the database. For example, if you were working with the database that requires an addition to the connection string, You would add it here. We have a straight forward connection though. So we'll leave these settings as they are. Click the submit button and after a few seconds a green message should display saying that the data source was connected successfully. If you aren't able to connect successfully to the data source, check your username and password. Also check the name of the default database you selected in the system DSN process. That frequently will cause an error in connecting. If you experience any problems with this data source down the road, you can come back to this screen to verify that it can be reached by Cold Fusion. If you experience any problems with this data source down the road, you can come back to this screen to verify that it can be reached by Cold Fusion.
Tutorial Information
| Course: | Macromedia ColdFusion MX |
| Author: | Darcey Spears |
| SKU: | 33474 |
| ISBN: | 1932072772 |
| Release Date: | 2004-03-05 |
| Duration: | 6.5 hrs / 102 lessons |
| Work Files: |
Yes |
| Captions: | For Online University members only |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 