be used or copied only in accordance with the terms of such license. The content of this
manual is furnished for info rmatio nal us e only , is su bject to cha nge with out noti ce, an d
should not be construed as a commitment by Macromedia, Inc. Macromedia Inc.
assumes no responsibility or liability for any errors or inaccuracies that may appear in
this book.
Except as permitted by such license, no part of this publication may be reproduced,
stored in a retrieval system, or transmitted in any form or by any means, electronic,
mechanical, record ing, or otherwise , without the prior written permission of Macromedia
Inc.
ColdFusion and HomeSite are U.S. registered trademarks of Macromedia
Inc.macromedia inc.M ac rom edi a, the Mac r om ed ia log o, Macr om ed ia Spec tra ,
ColdFusion logo , a nd J Run are tr adema rks o f Ma crome dia, I nc . Java is a t radema rk of
Sun Microsystems, Inc. Microsoft, Windows, Windows NT, Windows 95, Microsoft
Access, and FoxPro are registered trademarks of Microsoft Corporation. PostScript is
a trademark of Adobe Systems Inc. Solaris is a trademark of Sun Microsystems Inc.
UNIX is a trademark of The Op en Grou p.All oth er comp any nam es, bra nd name s, and
product names are trademarks of their respective holder(s).
Advanced ColdFusion Administration is intended for anyone who needs to perform
ColdFusion server management tasks, such as configuring advanced security or
managing clustered servers.
New Features
The following table lists the new features in ColdFusion 5:
BenefitFeatureDescription
Breakthrough
productivity
Powerful
business
intelligence
capabilities
Enhanced
performance
User-defined functionsCreate reusable functions to
accelerate development.
Query of queries
Easily integrate data from
heterogeneous sour ce s by
merging and querying data in
memory using standard SQL.
Server analysis and
troublshooting
Quickly detect and diagnose
server errors with built-in server
reporting and the new Log File
Analyzer.
Charting engine
Create professional-quality charts
and graphs from queried data
without leaving the ColdFusion
environment.
Enhanced V erity K2 fu ll-text
search
Index and search up to 250,000
documents and enjoy greater
performance.
Reporting interface for
Crystal Reports 8.0
Create professional-quality
tabular reports from queried data
and applications.
Core engine tuning
Take advantage of dramatically
improved server performance and
reduced memory usage to deliver
faster, more scalable applications.
Incremental page delivery
Improve response time by
delivering page output to users as
it is built.
Wire protocol database
drivers
Deliver high-performance ODBC
connectivity using new drivers.
Developer Resourcesxv
BenefitFeatureDescription
Easy
managment
Application deployment
services
Effortlessly and reliably deploy,
archive, or restore entire
applications using ColdFusion
archive files.
Enhanced application
monitoring
Keep track of server performance
and availability with customizable
alerts and recovery.
SNMP support
Monitor ColdFusion applicatio ns
from enterprise management
systems.
Expanded
integration
Expanded Linux support
Deploy on additional Linux
distributions, including SuSE and
Cobalt.
Enhanced hardware load
balancer integration
Apply optimized, agent-based
support for hardware load
balancers, including new support
for the Cisco CSS 11000.
Enhanced COM support
Experience easier integration with
COM components.
Developer Resources
Macromedia Corpo r a tion is comm itte d to set tin g the stan da r d fo r custom e r suppo rt
in developer education, tech nical supp o rt, and pro fes sio nal services . T he Web site is
designed to give you quick access to the entire range of online resources, as the
following table describes.
ResourceDescriptionURL
Macromedia Web siteGeneral information about Macromedia
products and services
Information on
ColdFusion
Technical SupportProfessional support progra ms that
ColdFusion Support
Forum
Detailed p roduct information on
ColdFusion and related topics
Macromedia offers
Access to experienced ColdFusion
developers through participation in the
Online Forums, where you can post
messages and read replies on many
subjects relating to ColdFusion
www.macromedia.com/
www.coldfusion.com/products/
coldfusion/
www.coldfusion.com/support/
http://forums.allaire.com/coldfusion/
xvi About This Book
ResourceDescriptionURL
Installation SupportSupport for installation-related issues
for all Macromedia products
Professional Education Information about classes, on-site
training, and online courses offered by
Macromedia
Developer Community All the resources that you need to stay
on the cutting edge of ColdFusion
development, including online
discussion groups, Knowledge Base,
technical papers, and more
ColdFusion Dev Center Development tips, articles,
documentation, and white papers
Macromedia AllianceConnection with the growing network of
solution providers, applica tion
developers, resellers, and hosting
services creating solutions with
ColdFusion
www.coldfusion.com/support/
installation/
www.coldfusion.com/developer/
training.cfm
www.coldfusion.com/developer/
www.coldfusion.com/developer/
referencedesk/
www.coldfusion.com/partners/
About ColdFusion Documentation
ColdFusion documentation is designed to provide support for ColdFusion
developers and ColdFusion Server administrators. The print and online versions are
organized to allow you to quickly lo cate the information that you need. The
ColdFusion online documentation is provided in HTML and Adobe Acrobat formats.
Printed and online documentation set
The ColdFusion documentation set consists of the following titles.
BookDescription
Installing and
Configuring
ColdFusion Server
Advanced
ColdFusion
Administration
Developing
ColdFusion
Applications
Describes system installation and basic configuration for
Windows NT, Windows 2000, Solaris, and Linux
Describes how to connect your data sources to the ColdFusion
Server, configure security for your applications, and how to use
ClusterCATS to manage scalability, clustering, and
load-bal ancing for your site
Describes on how to ColdFusio n Server to develop yo ur dynamic
Web applications, including retrieving and updating your data,
using structures, and forms
syntax, usage, and code examples for all ColdFusion tags,
functions, and variables
CFML Quick
Reference
A brief guide that shows the syntax of ColdFusion tags,
functions, and variables
Viewing online documentation
All ColdFusion documentation is available online in HTML and Adobe Acrobat PDF
formats. To view the HTML documentation, open the following URL on the We b
server running ColdFusion: http://localhost/cfdocs/dochome.htm.
ColdFusion documentation in Acrobat format is available on the ColdFusion
product CD-ROM and for download from the ColdFusion web site: http://
www .coldfusion.com.
ColdFusion Studio documentation
ColdFusion Studio contains a wide range of online assistance, including a complete
collection of ColdFusion documentation. T o vie w ColdFu sion online documentation
from within ColdFusion Studio, click the Help resource tab. You will see an
expandable list of documents about ColdFusion Server and ColdFusion Studio, as
well as other information that relates to Web programming:
ColdFusion Studio online documentation is searchable and you can bookmark
individual pages. For more information about using the Cold Fu sion S tud io interface ,
see the ColdFusion Studio documentation set.
Getting Answers
One of the best ways to solve particular programming problems is to tap into the vast
expertise of the ColdFusion developer communities on the ColdFusion Forums.
Other devel opers on th e forum can help y ou f igur e out ho w to do jus t abo ut a nythin g
with ColdFusion. The search facility can also help you search messages from the
previous 12 months, allowing you to learn how others have solved a problem that
you might be facing. The Fo rums is a gr e at r es our ce for learning C oldF u sion, bu t it is
also a great place to see the ColdFusion developer community in action.
xviii About This Book
Contacting Macromedia
Corporate
headquarters
Technical
support
Sales
Macromedia, Inc.
600 Townsend Street
San Francisco, CA 94103
Tel: 415.252.2000
Fax: 415.626.0554
Web: www.macromedia.com
Macromedia offers a range of telephone and Web-based
support options. Go to http://www.coldfusion.com/
support/ for a complete description of technical support
services.
You can make postings to the ColdFusion Support Forum
(http://forums.coldfusion.com/DevConf/index.cfm) at
any time.
This part describes data source management and introduces the
ColdFusion Administrator tools. The fol lowing chapters are included:
Advanced Data Source Management ..................................................3
Administrator Too ls................. ............. ... ............. .. ............. .. ..............39
Chapter 1
Advanced Data Source
Management
This chapter describes how to create and configure ColdFusion data sources for
several databases using ODBC, OLE DB, and native drivers. It also describes how to
use ColdFusion to create a database file in a cfquery and how to use connection
string options.
For basic information on data sources and fo r information on ho w to connect to SQL
Server, Access, and Oracle databases, see Installing and Configuring ColdFusion Server.
• Using ColdFusion to Create a Data Source (UNIX only)........................................10
• Using Connection String Options............................................................................12
• Connecting to DB2 Databases.................................................................................15
• Connecting to dBASE/FoxPro Databases................................................................21
• Connecting to Excel Databases................................................................................24
• Connecting to Informix Databases..................................................... ...... ....... ...... ..26
• Connecting to Sybase Databases.............................................................................32
• Connecting to Text Databases..................................................................................35
• Connecting to Visual FoxPro Databases..................................................................37
4Chapter 1 Advanced Data Source Management
About ColdFusion database drivers
ColdFusion uses ODBC, OLE DB, and native database drivers. For detailed
information about ODBC drivers, see Installing and Configuring ColdFusion Server.
About OLE DB
OLE DB is a Microsoft specification for a set of interfaces designed to access data.
Although ODBC is primarily used to access SQL data in a platform-independent
manner, OLE DB is designed to access SQL and non-SQL data in an OLE Component
Object Model (COM) environment.
Note
OLE DB is available only on Windows NT/2000.
ColdFusion developers can access a range of data stores through Microsoft OLE DB,
including:
• MAPI-based data stores such as Microsoft Exchange and Lotus Mail
• Nonrelational data stores, such as Lotus Notes
• LDAP 2.0 data
• Data from OLE applications like word processors and spreadsheets
• Mainf rame data
• HTML and text files, flat-file data
For more information, including a list of provider vendors, visit the Microsoft OLE
DB site at http://www.microsoft.com/data/oledb/.
About OLE DB providers
Before ColdFusion can use OLE DB to access data stores, you must install an OLE DB
provider, available from third-party vendors. The provider software handles data
processing in response to requests from the OLE DB consumer, which in this case is
ColdFusion.
ColdFusion uses an OLE DB provider to access an OLE DB data source. An OLE DB
provider is a COM component that accepts calls to the OLE DB Application
Programming Interface (API) and processes that request against the data source.
You can often achieve sultry performance levels by running an OLE DB provider,
instead of an ODBC driver, to process SQL. This depends on how the provider
implements the data call. Some providers route OLE DB calls through the ODBC
Driver Manager, while others go directly to the data bas e. Provi ders tha t g o d ir e ctly to
the database are akin to native drivers in providing an alternative to ODBC. Providers
are available for all the major relational DBMS products as well as the data stores
previously mentione d.
About ColdFusion database drivers5
Installing the OLE DB provider
Before you configure an OLE DB data source, you must have installed a recent
version of the Microsoft Data Access Components (MDAC). MDAC includes two OLE
DB providers—SQLOLEDB and MSDASQL. For Access d atabases, Microsoft makes
available a Jet provider. For SQL Server, Microsoft offers MSDASQL and SQLOLEDB
providers.
During its installation process, ColdFusion attempts to detect the MDAC version on
your computer. If MDAC is absent or the identified version is 2.0 or earlier,
ColdFusion installs MDAC version 2.5 and restarts the installation process. If you
install MDAC on a Windows NT system, you get the MSDASQL and SQLOLEDB
providers.
For updated versions of MDAC, visit the Microsoft Universal Data Access Download
Page at http://www.microsoft.com/data/download.htm/.
Note
Before you install MDAC, stop all unnecessary services, such as Web servers, virus
scanning programs, or mail servers.
You should be aware of the following characteristics in how ColdFusion handles OLE
DB:
• The initial driver drop-down list box does not display all of the installed OLE DB
providers. If you are creating a data source using a provider other than
SQLOLEDB or Jet, such as MSDASQL or a MERANT OLE DB driver, you must
select other from the drop-down list box.
• No matter which provider you select from the drop-down list box, you must still
retype its name in the Provider field.
• When using MSDASQL, you must have an ODBC data source already defined for
the database. Enter this ODBC DSN in the ProviderDSN text box.
6Chapter 1 Advanced Data Source Management
The following procedure describes how to configure an OLE DB data source to a
Microsoft SQL Server database on Windows NT, using SQLOLEDB as the provider.
To configure an OLE DB data source:
1Open the ColdFusion Administrator.
2 Under Data Sources, click OLE DB.
The OLE DB Data Sources page displays any existing OLE DB Data Source Names
that are available to ColdFusion:
3 Enter a name for the new data source and select an OLE DB Provider from the
drop-down list.
Note
Do not name a ColdFusion data source Registry or Cookie, as these words are
reserved for use by ColdFusion.
4Click Add.
The Create OLE DB Interface Data Source page displays:
5 (Optional) Enter a description.
About ColdFusion database drivers7
6 Enter the following connection information:
•If SQLOLEDB is the provid er Enter SQLOLEDB a s the Provider, specify the
Server that hosts the database, and specify the name of the Default Database.
Note
For the Server field, if the database is a local SQL Server database, enclose the
word local in parentheses: (local).
•If Microsoft Jet is the provider Enter Microsoft.Jet.versionnumber as the
Provider (such as Microsoft.Jet.OLEDB.4.0), and specify the path to the
Database File.
•If you are using another provider Enter its name as the Provider. Be aware
that MSDASQL requires a predefined ODBC data source for the database to
which you will connect. Enter the name of the ODBC data source in the
Provider DSN field.
8Chapter 1 Advanced Data Source Management
7 Click CF Settings and specify any ColdFusion-specific settings. For example,
enter a username and password if required for the data source.
Note
The omission of required username and password information is a common
reason why a data source fails to verify.
8 Click Create to create the new data source.
ColdFusion automatically verifies that it can connect to the data source.
If ColdFusion cann ot verify the data sou rce, the S tatu s d isp lays a s Failed. You c an
cfquery against the failed data source to get more detailed information
run a
about the problem. You also can try embedding a username and password into
cfquery tag to see if the query works.
the
About ColdFusion database drivers9
If you are creating a UNIX data source, you might need to set environment
variables for your database client library by editing the ColdFusion start script in
<installdir>/coldfusion/bin. F or detailed information about editing the
ColdFusion start script for your particular database, see the section about your
database.
About native drivers
The Enterprise Edition of ColdFusion Server includes support for DB2, Informix,
Sybase System 11 through Sybase Adaptive Server 12.0, and Oracle 7.3.4, 8.0, and 8i
databases through native database drivers on both Windows NT and UNIX
platforms.
You might consider using native database drivers for the following reasons:
• Native drivers tend to offer better performance than their ODBC counterparts.
• Some stored procedure functionality is only available through native drivers. For
example, you must use an Oracle native driver to use packages.
Software requirements for native drivers
Before you can use the ColdFus ion native database drivers, you must install
additional client software. Also, you must install the database client software and
ColdFusion Server software on the same server.
The following table describes requirements for each database and each supported
platform:
Database Client SoftwareFor more information
OracleOracle 7.3.4, Oracle 8.0.x
or Oracle 8.1.6 or higher
SybaseSybase Open/Client
1 1.1 .1, 11.9.2 or 12.0
InformixInformix 2.50 SDK or
higher
IBM DB2 IBM DB2 Client
Application Enabler
version 5 or 6
Installing and Configuring ColdFusion Server
“Connecting to Sybase Databases,” on page
32
“Connecting to Informix Databases,” on pag e
26
“Connecting to DB2 Databases,” on page 15
10Chapter 1 Advanced Data Source Management
Using ColdFusion to Create a Data Source (UNIX only)
The MERANT ODBC drivers that ship with all UNIX versions of ColdFusion include a
FoxPro 2.5/dBASE driver. You can use the FoxPro 2.5/dBASE driver to create a
database file in a
Oracle, Informix, Sybase, or DB2 database.
Note
See the MERANT DataDirect ODBC Reference for details about SQL statements used
for flat-file drivers. The default location of this reference on UNIX machines is:
<installdir>/coldfusion/odbc/doc/odbcref.pdf. On Win32 machines, the default
location is: <installdir>/cfusion/bin/odbcref.pdf.
You need to create tables in a data source called newtable.
T o create a table in the data source:
1 Create the newtable data source in the ColdFusion Administrator, specifying the
MERANT dBASE/FoxPro ODBC driver.
If you do not create the data source, you receive an error when you try to execute
this page.
2 Use the following code to generate these fields in the newtable data source:
cfquery with standard SQL syntax even if you do not have an
ColdFusion 5 allows you to specify a connection string for ODBC data sources. You
can do this programmatically or in the ColdFusion Administrator.
About the connection string
You can use the connection string to do the following tasks:
• Specify connection attributes that cannot be defined in the odbc.ini settings.
• Override odbc.ini settings.
• Make ODBC connections dynamically when there is no data source defined in
the odbc.ini settings.
Some ODBC data sources let you pass driver-specific options. A database
administrator (DBA) can use t hese options to see whic h applications are connected
to the database server, and to identify who is running those applications. For
example, many applications that connect to Microsoft SQL Server pass the
attribue-value pairs APP="appname" and WSID="work station id" when connecting.
Consider the following
the APP and WSID attributes