Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8937449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:25:03+00:00 2026-06-15T10:25:03+00:00

EDIT : This only happens with MSSQL & jtds 1.2.6 Still investigating… **Duplicate of

  • 0

EDIT: This only happens with MSSQL & jtds 1.2.6 Still investigating…
**Duplicate of : Mule 3.3.0 Jdbc Transaction Undesired Commit
**Mule Documentation sucks.

I want to rollback everything inside a flow that has several database endpoints.
I have a single JDBC datasource resource (i.e. no need for fancy XA, 2PC, etc).
I have managed to configure Mule to, at least, not complain that no Transaction Manager is configured, etc…. but: It doesn’t work; i.e it does not rollback the transaction when an exception occurs.
Since I’m running Mule standalone, I don’t have fancy weblogic, jboss, etc transactionmanagers so I thought I could use Spring’s DataSourceTransactionManager. What other choice I have for this?

Here is my flow (flow1 is just for triggering flow2, wich is the one I want to be transactional):

Flow

And the XML:

<?xml version="1.0" encoding="UTF-8"?>
<mule version="CE-3.3.0">
    <spring:beans>
        <spring:bean id="transactionManager"
            class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <spring:property name="dataSource" ref="dataSource" />
        </spring:bean>

        <spring:bean id="transactionFactory"
            class="org.mule.module.spring.transaction.SpringTransactionFactory">
            <spring:property name="manager" ref="transactionManager" />
        </spring:bean>

        <spring:bean id="dataSource" name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <spring:property name="driverClassName" value="com.mysql.jdbc.Driver"/>
            <spring:property name="url" value="jdbc:mysql://localhost/mydb"/>
            <spring:property name="username" value="sa"/>
            <spring:property name="password" value=""/>
        </spring:bean>    
    </spring:beans>

    <jdbc:connector name="jdbcConnector" dataSource-ref="dataSource"
        transactionPerMessage="true" queryTimeout="20000" pollingFrequency="10000"
        doc:name="Database" validateConnections="false"></jdbc:connector>
    <flow name="flow1" doc:name="flow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
        <vm:outbound-endpoint exchange-pattern="request-response" path="toFlow2" doc:name="VM"/>
    </flow>
    <flow name="flow2" doc:name="flow2">
        <vm:inbound-endpoint exchange-pattern="request-response" path="toFlow2" doc:name="VM">
        <custom-transaction factory-ref="transactionFactory" action="ALWAYS_BEGIN" timeout="10"/>
    </vm:inbound-endpoint>
        <jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="query1" queryTimeout="-1" connector-ref="jdbcConnector" doc:name="Database">
            <jdbc:query key="query1" value="insert into Foo (field1) values ('bar')"/>
            <jdbc:transaction action="ALWAYS_JOIN"/>
        </jdbc:outbound-endpoint>
        <jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="query2" queryTimeout="-1" connector-ref="jdbcConnector" doc:name="Database">
            <jdbc:query key="query2" value="insert into Bar (field1) values ('foo')"/>
            <jdbc:transaction action="ALWAYS_JOIN"/>
        </jdbc:outbound-endpoint>
    </flow>

</mule>

Not shown here, I also have a default exception catch strategy, that simply writes the faulty payload to a file. I don’t know if I need to do a rollback explicitly, but I didn’t find how.

Any help would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:25:04+00:00Added an answer on June 15, 2026 at 10:25 am

    After two days of banging my head against Mule I finally managed to make this work.
    Conclusions:

    • You need to use jTDS‘s own DataSource (net.sourceforge.jtds.jdbcx.JtdsDataSource)
    • You need to use mule’s TransactionFactory (org.mule.transport.jdbc.JdbcTransactionFactory)
    • You need to use the undocumented (or at least, under-documented) tag to start transaction
    • jTDS ando/or Mule sucks (I don’t know who is responsible for this particular issue).
    • Mule Documentation sucks big time: this and this
    • MuleStudio sucks big time (Sloooow, buggy, no way to wire transactions via the GUI, assertexceptions, flows gets messed up if you drag and drop scripts, etc, etc).

    The final working flow:

    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc" xmlns:http="http://www.mulesoft.org/schema/mule/http"
        xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans"
        version="CE-3.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
    http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd 
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
    http://www.mulesoft.org/schema/mule/jdbc http://www.mulesoft.org/schema/mule/jdbc/current/mule-jdbc.xsd 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
    http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd ">
    
        <spring:beans>
            <spring:bean id="jtdsDataSource" name="jtdsDataSource" class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
                <spring:property name="user" value="your_user" />
                <spring:property name="password" value="your_password" />
                <spring:property name="databaseName" value="your_database" />
                <spring:property name="serverName" value="your_host" />
            </spring:bean>
    
            <spring:bean id="transactionFactory" name="transactionFactory" class="org.mule.transport.jdbc.JdbcTransactionFactory" />
    
        </spring:beans>
    
        <jdbc:connector name="dbConnector" dataSource-ref="jtdsDataSource" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database" />
    
        <flow name="TriggerTxFlow" doc:name="TriggerTxFlow">
            <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP" />
            <vm:outbound-endpoint exchange-pattern="request-response" path="toTxFlow" doc:name="VM" />
        </flow>
        <flow name="TxFlow" doc:name="TxFlow">
            <vm:inbound-endpoint exchange-pattern="request-response" path="toTxFlow" doc:name="VM">
                <custom-transaction factory-ref="transactionFactory" action="ALWAYS_BEGIN" timeout="10" />
            </vm:inbound-endpoint>
            <jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="insert" queryTimeout="-1" connector-ref="dbConnector" doc:name="Database">
                <jdbc:transaction action="ALWAYS_JOIN" />
                <jdbc:query key="insert" value="insert into test values (1, 'Test 1')" />
            </jdbc:outbound-endpoint>
            <jdbc:outbound-endpoint exchange-pattern="request-response" queryKey="insert2" queryTimeout="-1" connector-ref="dbConnector" doc:name="Database">
                <jdbc:transaction action="ALWAYS_JOIN" />
                <jdbc:query key="insert2" value="insert into test values (2, 'Test 2')" />
            </jdbc:outbound-endpoint>
        </flow>
    </mule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: This happens only in IE8, it works fine in IE7, Firefox, Opera etc
[Edit: This problem applies only to 32-bit systems. If your computer, your OS and
How can I edit this to run only once after user scroll up: (function
EDIT: This code now works correctly, I only left it in case someone finds
EDIT : It turned out that this can only be done through an external
So, I have this code in a controller: before_filter :require_login, :only => :new, :edit,
I have this weird crash that only happens when running the app on the
First of all, this only happens on IE, in firefox 3.6 everything works well,
Edit: This problem was down to me passing the wrong view to the Touch
edit This question is solved! Having something weird. I'm using html { font-size: 100%

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.