
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.
6
Click 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.
9
Locate
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.
Содержание COLDFUSION 5-DEVELOPING
Страница 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Страница 58: ...38 Chapter 3 Querying a Database ...
Страница 134: ...114 Chapter 7 Updating Your Database ...
Страница 210: ...190 Chapter 10 Reusing Code ...
Страница 232: ...212 Chapter 11 Preventing and Handling Errors ...
Страница 238: ...218 Chapter 12 Using the Application Framework ...
Страница 262: ...242 Chapter 12 Using the Application Framework ...
Страница 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Страница 320: ...300 Chapter 15 Indexing and Searching Data ...
Страница 336: ...316 Chapter 16 Sending and Receiving E mail ...
Страница 374: ...354 Chapter 18 Interacting with Remote Servers ...