Menu

#89 autoCommitOnClose(true) does not commit on close

open
nobody
None
5
2010-12-03
2010-12-03
Anonymous
No

From the documentation of autoCommitOnClose
"Setting autoCommitOnClose to true causes uncommitted pending work to be committed, rather than rolled back on Connection close."

C3P0 *does* do a rollback in this screnario if autoCommitOnClose is false as described in the documentation.

However C3P0 does not "cause[] uncommitted pending work to be committed, rather than rolled back on Connection close."

The following JUnit test case illustrates this testing the rollback and commit behaviour. It uses the H2 database in memory mode.
I am using h2-1.2.147.jar from http://repo2.maven.org/maven2/com/h2database/h2/1.2.147/h2-1.2.147.jar

I can also supply a junit test case of the very similar behaviour against Oracle. (H2 always uses table locks, and so fails early, with Oracle, the test is a little longer to prove a fresh connection has an uncommitted transaction.)

Discussion

  • Nobody/Anonymous

    JUnit test case illustrating the behaviour.

     
  • Banjaxed

    Banjaxed - 2010-12-03

    c3p0-0.9.1.2.jar
    h2-1.2.147.jar
    junit4

     

Log in to post a comment.