For the complete experience, please enable JavaScript in your browser. Thank you!

  • Creative Cloud
  • Photoshop
  • Illustrator
  • InDesign
  • Premiere Pro
  • After Effects
  • Lightroom
  • See all
  • See plans for: businesses photographers students
  • Document Cloud
  • Acrobat DC
  • eSign
  • Stock
  • Elements
  • Marketing Cloud
  • Analytics
  • Audience Manager
  • Campaign
  • Experience Manager
  • Media Optimizer
  • Target
  • See all
  • Acrobat Reader DC
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player
  • All products
  • Creative Cloud
  • Individuals
  • Photographers
  • Students and Teachers
  • Business
  • Schools and Universities
  • Marketing Cloud
  • Document Cloud
  • Stock
  • Elements
  • All products
  • Get Support
    Find answers quickly. Contact us if you need to.
    Start now >
  • Learn the apps
    Get started or learn new ways to work.
    Learn now >
  • Ask the community
    Post questions and get answers from experts.
    Start now >
    • About Us
    • Careers At Adobe
    • Investor Relations
    • Privacy  |  Security
    • Corporate Responsibility
    • Customer Showcase
    • Events
    • Contact Us
News
    • 3/22/2016
      Adobe Summit 2016: Are You An Experience Business?
    • 3/22/2016
      Adobe Announces Cross-Device Co-op to Enable People-Based Marketing
    • 3/22/2016
      Adobe and comScore Advance Digital TV and Ad Measurement
    • 3/22/2016
      Adobe Marketing Cloud Redefines TV Experience
Developing Applications Help / 

Database-related enhancements in ColdFusion 10

Adobe Community Help


Applies to

  • ColdFusion

Contact support

 
By clicking Submit, you accept the Adobe Terms of Use.
 
  • Track client information
  • Support for new SQL types
  • Miscellaneous enhancements that include enhancements to connection validation and exception handling

Tracking client information

To enable auditing on database, while performing a database operation, you can track certain client information, such as application name or client ID. The supported client information varies from database to database. For example, Oracle supports client information in a table named $v_session. Other databases store it in local cache or registers. 
You can send the client information using the ClientInfo attribute in the following ColdFusion tags: cfquery, cfupdate, cfinsert, and cfstoredproc. The information sent is set before executing the query.
The following are the values supported by the ClientInfo attribute:

  • AccountingInfo
  • Action: The action performed by the query.
  • ApplicationName: Application name.
  • ClientHostName: The host from where the query is executed.
  • ClientID: The client ID.
  • ClientUser: The user ID.
  • ProgramID: The program ID.
  • Module: The module name.
    Use the cfdbinfo tag to find the supported clientInfo properties.
    Example

<cfscript>
clientInfo = structNew();
clientInfo.AccountingInfo = "MyAccount_cfquery";
clientInfo.Action = "cfstoredproc_cfquery";
clientInfo.ApplicationName = "testApp_cfquery";
clientInfo.ClientHostName = "Testserver_cfquery";
clientInfo.ClientID = "testID_cfquery";
clientInfo.ClientUser = "cfadmin_cfquery";
clientInfo.ProgramID = 1234;
clientInfo.Module = "test_query";
</cfscript>
<cfquery name="qName" datasource="#regdatasource#" clientInfo="#clientInfo#">
Select * from employees
</cfquery>

Accessing client information metadata

The cfdbinfo tag supports the ClientInfo value for the type attribute. If this value is specified, the metadata supported for the specified data source is returned.

<CFDBINFO type="clientinfo" datasource="#regdatasource#" name="result">
<cfdump var="#result#">

Accessing client information

When you perform a database operation using the fetchclientinfo attribute, you can access the database-specific client information. The following ColdFusion tags support the fetchclientinfo attribute: cfquery, cfinsert, and cfstoredproc. If set to true, the attribute returns a struct with the key-value pair passed by the last query.Example

<cfquery fetchclientinfo=true result="resultQ" datasource="#regdatasource#">
select * from employees
</cfquery>

Passing client information using ColdFusion administrator

Using the ColdFusion administrator's Data Sources Advanced Settings page, you can set the database-specific information. If specified, the following information is sent to the database before executing the query.

  • Client Hostname: The host name from where the query is executed.
  • Client Username: The user name if the user is logged in using the <cflogin> tag.
  • Application Name: The application name specified in the application.cfc.
  • Prefix: If specified, the value is prefixed with the application name specified in application.cfc.

    Note: If the same client info properties are specified in the query tag, it takes the precedence over the server-level settings.

New data type support for CFSQLType

The cfqueryparam and cfprocparam tags support the following SQL types:

  • CF_SQL_NCHAR
  • CF_SQL_NVARCHAR
  • CF_SQL_LONGNVARCHAR
  • CF_SQL_NCLOB
  • CF_SQL_SQLXML

Miscellaneous enhancements

Following are the miscellaneous enhancements:

Validating connection before executing a query

In the ColdFusion administrator's Data Sources Advanced Settings page, you can set the option to validate the connection. If this option is set, ColdFusion validates the database connection before executing a query. Setting this option can have an impact on the performance of the application.You can optionally specify a query to validate the connection. If specified, the connection is validated based on it. If not specified, the default mechanism is used to validate the connection.

Improved exception handling

The <cfcatch> tag's type=database property is improved for better exception handling.The #CFCATCH.exceptions# provides details in a list of structs. If multiple exceptions are thrown, it provides multiple elements. Each element provides information in the following categories: class, messages, and list of causes (if any).Example

<cftry>
<cfquery datasource="badmysql" timeout="2">
Select * from employees
</cfquery>
<cfcatch type="database">
<cfdump var="#cfcatch#">
</cfcatch>
</cftry>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy

Choose your region United States (Change)   Products   Downloads   Learn & Support   Company
Choose your region Close

Americas

Europe, Middle East and Africa

Asia Pacific

  • Brasil
  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Cyprus - English
  • Česká republika
  • Danmark
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Greece - English
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • Malta - English
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • Southeast Asia (Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam) - English
  • 台灣

Commonwealth of Independent States

  • Includes Armenia, Azerbaijan, Belarus, Georgia, Moldova, Kazakhstan, Kyrgyzstan, Tajikistan, Turkmenistan, Ukraine, Uzbekistan

Copyright © 2016 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

AdChoices