CFTransaction doesn't rollback on error

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default CFTransaction doesn't rollback on error

    Hi all, years ago on CF 4.5, our cftransaction tags used to rollback changed
    data when something inbetween <cftransaction> and </cftransaction> failed or
    even a <cfabort>. But ever since we upgraded to CFMX, they do not roll back
    data. We also went to JDBC at the same time, I don't know if that has anything
    to do with it. About the same time, we also changed from MSSQL 7 to MSSQL
    2000. And we are currently on CFMX7. Somewhere in all this changing,
    cftransaction broke. I'm at a loss. What should we check to get this working
    again? Thanks in advance.

    CFGumby Guest

  2. Similar Questions and Discussions

    1. cftransaction
      I have a question about CFTRANSACTION. We are currently using CF6.0 with various versions of Oracle and SQL Server. In our server settings we do...
    2. SFTP rollback error
      I have a really wierd error when publishing with rollbacks via SFTP. I should start by saying that I am using the contribute client on Mac OS X,...
    3. CFtransaction error
      I'm getting the following error: Nested transactions are not supported. A cftransaction tag can not be nested within another cftransaction tag. ...
    4. Error with cftransaction
      I have a method with a cftransaction and inside the cftransaction calls a method that has a cftransaction, before updating to 6.1 I didnt have any...
    5. CFTRANSACTION w/ ROLLBACK
      Here's what I'm trying to do, this worked in CF 5, but bombs with the following error in CFMX 6: The <CFCATCH> tag requires an end tag to nest...
  3. #2

    Default Re: CFTransaction doesn't rollback on error

    Please present your code. Hope you use somethging like that within cftransaction tags
    <cfcatch type="database">
    <cftransaction action = "rollback"/>
    </cfcatch>
    CF_Oracle Guest

  4. #3

    Default Re: CFTransaction doesn't rollback on error

    Please present your code. Hope you use somethging like that within cftransaction tags
    <cfcatch type="database">
    <cftransaction action = "rollback"/>
    </cfcatch>
    CF_Oracle Guest

  5. #4

    Default Re: CFTransaction doesn't rollback on error

    That was one version. Normally, it was like this;
    <cftransaction>
    <cfquery...>
    </cfquery>
    <cfquery...>
    </cfquery>
    </cftransaction>

    That used to work. I've tried that in a test script and also your way;
    <cftransaction>
    <cftry>
    <cfquery...>
    </cfquery>
    <cfquery...>
    </cfquery>
    <cfcatch type="any">
    <cftransaction action = "rollback"/>
    </cfcatch>
    </cftry>
    </cftransaction>

    Niether one works, but they used to.

    Thanks.

    CFGumby Guest

  6. #5

    Default Re: CFTransaction doesn't rollback on error

    <cftransaction>
    <cftry>
    <cfquery...>
    </cfquery>
    <cfquery...>
    </cfquery>
    <cfcatch type="any">
    <cftransaction action = "rollback"/>
    </cfcatch>
    </cftry>
    </cftransaction>

    Better is

    <cftry>
    <cftransaction>
    <cfquery...>
    </cfquery>
    <cfquery...>
    </cfquery>
    <cfcatch type="any">
    <cftransaction action = "rollback"/>
    </cfcatch>
    </cftransaction>
    </cftry>


    But ever since we upgraded to CFMX, they do not roll back data.

    If the queries run without errors, Coldfusion's default behaviour is to
    commit. It's therefore not clear to me why you expect the transaction to roll
    back. Was there an error?



    BKBK Guest

  7. #6

    Default Re: CFTransaction doesn't rollback on error

    Sorry, this is basically a copy of our test cfm. I purposely misspelled a
    field name in the second query, forcing it to fail and it does. However, the
    update from the first queries still exits in the database. In the second
    query, I misspelled UserID (UserIDx).
    Here are the two queries. Thanks.
    <cfquery name="qUpd" datasource="MSSQLDB" dbtype="query">
    UPDATE Access
    SET Access = 1
    WHERE UserID = 1
    </cfquery>

    <cfquery name="qUpd2" datasource="MSSQLDB" dbtype="query">
    UPDATE Access
    SET Access = 2
    WHERE UserID = 1
    AND UserIDX = 1
    </cfquery>

    CFGumby Guest

  8. #7

    Default Re: CFTransaction doesn't rollback on error

    I found the problem, it is dbtype="query". This is left over from CF 4.5 and
    now (from CF help) "all values of the attribute DBTYPE have been depricated
    except for QUERY. They do not work, and might cause an error, in releases
    later than ColdFusion 5." Why would MM (or Adobe) depricate something and then
    let it cause a problem? Sloppy (or lazy) upgrade mentality if you ask me.
    "Seamless upgrade" my asterisk.

    CFGumby Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139