Announcement Announcement Module
Collapse
No announcement yet.
How to turn Auto Commit off when using App Server DataSource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to turn Auto Commit off when using App Server DataSource

    I've implemented a few DAO classes based on SqlQuery, SqlUpdate, etc. The DAO classes are being called by a Session EJB using declarative CMT on WebSphere 5. I thought that WebSphere doesn't rollback transactions when there's an exception thrown, but it actually does. The problem seems to be AutoCommit is on, as i'm using spring JDBC wrappers, i have no direct access to Connection, how do i turn AutoCommit off?

    Here's my bean definition for the DataSource:
    <bean id="myDataSource"
    class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <value>jdbc/OraDS</value>
    </property>
    </bean>

    Thanks in advance!

  • #2
    Usually autocommit is indeed turned off for container-managed DataSources.

    Try to check out the administration console of your WebSphere server. There should be the configuration of the DataSource and hopefully also a flag to switch off autocommit. If you cannot do that, ask your administrator to have a look at it.

    Regards,
    Andreas

    Comment


    • #3
      Thank you Andreas! would spring JDBC wrappers turn autocommit on by any chance?

      Comment


      • #4
        Originally posted by jhong
        Thank you Andreas! would spring JDBC wrappers turn autocommit on by any chance?
        Spring's JDBC templates just operate on passed-in DataSources, The configuration of these is not an issue of Spring's abstraction layer. So I would say that Spring by itself does nothing here.

        Maybe the underlying connection is exposed somewhere inside application code? Then autocommit could be switched on there (or, as suggested earlier, it is a configuration issue in WebShere).

        Regards,
        Andreas

        Comment

        Working...
        X