cftransaction with multiple data sources

Posted on 2006-04-04
Last Modified: 2013-12-24
I have a script that basically pulls data from one dsn and inserts it using another dsn.

I am currently wrapping each insert in DSN 1 with a cftry and then at the end

  <cfcatch type = "DATABASE">
    <cfset commitIt = "No">
    <cftransaction action = "rollback"/>

at the end of the entire transaction i have the following:

  <cfif commitIt>
    <cftransaction action = "commit"/>
    Commits the pending insertion.
    <cfset commitIt = "Yes">


I'm getting an error  of:

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

This is correct because i have nested queries inside the transaction that lookup records and verify them.

What solution can i do to safely complete this transaction even when i have queries like this.
Question by:polobruce
    1 Comment
    LVL 18

    Accepted Solution


    You simply can't use cftransaction across datasources.

    Put the two different tasks within two seperate <cftransaction blocks.

    If one fails, you may need to code manually a rollback.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
    If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now