Adding Data Sources

Add data sources in the ColdFusion Administrator to define connection requirements for database queries.

When you add a data source, you assign it a name so that you can reference it within the CFQUERY tag on application pages to query databases. During a query, the data source tells ColdFusion which database to connect to and what parameters to use for the connection.

For example, you will add a data source that describes the ODBC requirements as well as login information when it is needed to make a connection to a database.

For information about the ColdFusion Administrator, ODBC, and data sources, refer to Chapter 13, Configuring ColdFusion Express Server.

Note To add a data source:
  1. Select Start > Programs > ColdFusion Express > ColdFusion Administrator.
  2. The Administrator prompts you for a password if you assigned one to the ColdFusion Server during install.

  3. Enter a password to gain access to the Administrator.
  4. Choose ODBC under the Server heading on the left menu.
  5. Name the data source HRExpress.
  6. Select Microsoft Access Driver (*.mdb) from the dropdown box to describe the ODBC driver.
  7. Choose Add.
  8. In the Database File field, enter the full path of the HRExpress.mdb Access database and click OK.
  9. This database was installed in the CFusion directory under the root of your hard drive.

    For example, the directory path on your machine may be:

    C:\CFusion\Database\HRExpress.mdb on Windows NT

  10. Choose Create to create the HRExpress data source.
  11. The data source is added to the data source list.

  12. Locate HRExpress in the data source list.
  13. Choose Verify to run the verification test on the data source.
  14. If the data source was created, you should see this message:

    The connection to the data source was verified successfully.

Note Note:Example code references the HRApp data source and the code that you write will reference the HRExpress data source.