Querying SQL 2000 Server from ColdFusion - Using ColdFusion data sources to connect to SQL Server 2000
(Page 2 of 4 )
When you log into the ColdFusion Administrator you can access the data related items by clicking on Data Sources under Data & Services in the navigational frame as shown. The Main frame shows all the connected data sources and provides an interface for adding a new data source as shown. There are four data sources that probably came with the installation that connect to MS Access database samples. If you now click on the Driver: drop-down arrow, you can see a variety of databases that you can query from ColdFusion applications as shown.

Since this tutorial is about connecting to a Microsoft SQL Server database, the appropriate choice is made as shown, and a name for the data source is chosen, CFSQL.

Now click on the Add button to add a new data source, which opens up the following screen. The view is shown with all the relevant information added. Here you give the data source a name, which you will later use in your query. You also specify the database, and the SQL 2000 server instance you will be connecting to, as well as the authentication information. You may also provide the authentication as a part of your query from your ColdFusion application. The name of the SQL Server is XPHTEK, and a short description of this source completes the configuration of the data source.

You can also see other possible advanced settings, and other choices you can make, by clicking on the Show Advanced Settings button which opens up the next screen. You have wide flexibility in using this data source by making appropriate choices.

For purposes of this tutorial, the default settings are used, and therefore you can now click on the Submit button. If the supplied information is acceptable, and authenticated, you will see that the data source you created is updated and appears in the list of connected data sources. You may also verify all the connections by clicking the Verify All Connections button. If the ODBC Agent has not started, then all the Microsoft Access related connections will show an error status, while it will not affect the SQL connection.

You have now created a data source which allows you to connect to the MS SQL Server's pubs database successfully.
Next: Querying pubs database with a ColdFusion query >>
More ColdFusion Articles
More By Jayaram Krishnaswamy