• Home
  • About George
  • Contact Me
Blue Orange Green Pink Purple

Guest Post: cftransaction & multiple datasources

Posted in ColdFusion, Databases. on Wednesday, August 5th, 2009 by superdave Tags: ColdFusion
Aug 05

I ran across an interesting error today regarding cftransactions and multiple cfqueries inside of them.
The resulting error was

The root cause was that: java.sql.SQLException: Datasource names for all the database tags within CFTRANSACTION must be the same.

This seems pretty straightforward, until you start digging into the problem, and become led down a few wrongs paths courtesy of google serving up results that aren’t entirely true.
One of the discussions I found was an adobe tech note, which I discovered via a link from a post by Ben Nadal.  In this tech note, the solution was to simply replace all cfexit tags, with a cfabort.

Simple, yes, except that I had NO cfexit tags within my cftry/cftransaction statement, they were already cfaborts!

Further investigation revealed that you simply cannot have multiple datasource names withing a cftransaction.

Now, with no actual documentation on the subject, and not actually knowing what spell coldfusion is uttering while it waves its wand over its magic hat, I cannot give a ‘good’ reason as to why.  All I know is the problem was fixed once I removed the offending query to outside the cftransaction.

In order to duplicate the desired effect, you will have to keep track of the transactions, and rollback/commit based on the prior cftransaction attempts, which is a discussion for another post.

-Dave

Leave a Reply

Web Development By George

  • About
    About me. Edit this in the options panel.
  • Photo Stream
  • Categories
    • ColdFusion
    • coldspring
    • Databases
    • Design
    • Flash
    • Flex
    • Internet
    • JavaScript
    • jQuery
    • Model-Glue
    • Personal
    • Subversion
    • Uncategorized
    • YUI
  • Recent Articles
    • Radios and JQuery and IE8
    • Coldfusion, Flex, and SSL
    • Leaving it to the Experts
    • CFAjaxProxy Problems or RTFM
    • I love the Internet
    • Interesting ColdFusion Survey
  • Archives
    • November 2011
    • May 2011
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • November 2009
    • October 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
  • Search




Add to Technorati Favorites

  • Home
  • About George
  • Contact Me

© Copyright Web Development By George. All rights reserved.
Designed by FTL Wordpress Themes brought to you by Smashing Magazine

Back to Top