User Guide

Accessing Data Sources 23
4 Name the data source CompanyInfo.
5 On Windows Select Microsoft Access Driver (*.mdb) from the drop-down box to
describe the ODBC driver. On UNIX, select the Merant Dbase/FoxPro driver.
6Click Add.
7 In the Database File field, enter the full path of the database. (You can also use
the Browse button to locate the file.).
On Windows specify the path to the company.mdb file, typically
C:\CFusion\database\Company.mdb. On UNIX, specify the path to the
CompanyInfo directory, typically /opt/coldfusion/database/CompanyInfo.
8 Click Create to create the
CompanyInfo data source.
The data source is added to the data source list.
9Locate CompanyInfo in the data source list.
10 Select Verify to run the verification test on the data source.
If the data source was created, you should see this message:
The connection to the data source was verified successfully.
11 Click Go Back to return to the data sources list.
For more information about managing data sources, see Advanced ColdFusion
Administration.
Specifying a connection string
You can dynamically override ODBC connection information that you set in the
ColdFusion Administrator. You can also specify connection attributes that are not
set in the Administrator. To do so, use the connectstring attribute in any CFML tag
that connects to a database:
cfquery, cfinsert, cfupdate, cfgridupdate, and
cfstoredproc.
For example, the following code creates a connection to a defined Microsoft
SQLServer data source using a connect string to specify the Application and Work
Station ID.
<cfupdate datasource = "mssql"
connectstring = "APP=ColdFusion;WSID=fenway"
tablename = "department">
Note
Connect string properties are specific to the database you are connecting to. See the
documentation for your database for a list of connect string properties.