ColdFusion MX 6.1 and MX 7: Incorrect cftransaction error thrown
Issue
A ColdFusion MX 6.1 or ColdFusion MX 7 application that has templates that include cftransaction tags may throw errors incorrectly on templates that have cfquery tags but no cftransaction tags within the same template.
The error logged in the application.log file for the template containing a cfquery tag but nocftransaction tags will be one of the following:
"Error","jrpp-500","11/05/03","16:51:25","ApplicationName","Data source dsn.name verification failed.The root cause was that: java.sql.SQLException: Datasource names for all the database tags within CFTRANSACTION must be the same. The specific sequence of files included or processed is: C:\CFusionMX\wwwroot\work\querytest.cfm"
or
"Error","jrpp-650","11/15/03","17:50:22","ApplicationName","Data source dsn.name verification failed.The root cause was that: java.sql.SQLException: Usernames and Passwords for all the database tags within CFTRANSACTION must be the same. The specific sequence of files included or processed is:C:\CFusionMX\wwwroot\work\querytest2.cfm"
When a cfexit tag is encountered within acftransaction block of code, the thread in use is released, regardless if the method attribute is specified. However, because the cftransaction end tag has not been executed yet, the data source name as well as username and password information remains with that thread. Therefore, the next ColdFusion template that runs a cfquery with a different data source name or username/password will cause one of the errors listed above because it assumes it is still within the same cftransaction.
This is logged as issue 53721.
Solution
In order to avoid this issue, replace any cfexit tags in cftransaction blocks withcfabort.
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
