lbehnke / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

JDBCConnectionPool always sets autoCommit(true) #191

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use a JDBCConnectionPool
2. When defining a connection URL include 'AUTOCOMMIT=FALSE'
3. Pull a connection from the pool.  
4. For first usage notice that the connection is properly set to AUTOCOMMIT
false
5. When returning connection to pool autocommit is set to true (regardless
of my intially used URL)
6. Pull the connection from the pool again and notice it is still
autocommit(true)

In the close() method of the PooledJDBCConnection class within
JdbcXAConnection a call is always made to 'setAutoCommit(true)'

What is the expected output? What do you see instead?
- I expect the connection to remain on autocommit false as configured.

What version of the product are you using? On what operating system, file
system, and virtual machine?
1.2.132, ALL OS, ALL VM.

Do you know a workaround?
- Always explicitly call Connection.setAutoCommit(false) when pulling
connections from the connection pool.  This then makes it pointless to
provide this in the URL.

In your view, is this a defect or a feature request?
- Defect.

Original issue reported on code.google.com by joe.witt on 15 Apr 2010 at 1:36

GoogleCodeExporter commented 9 years ago
While I understand the problem, I'm afraid there is little I can do because the
connection pool implementation (could be a third part) is supposed to enable
autocommit. But I will change the SET AUTOCOMMIT documentation:

-----------

SET AUTOCOMMIT { TRUE | ON | FALSE | OFF }

Switches auto commit on or off. This setting can be appended to the database 
URL:
jdbc:h2:test;AUTOCOMMIT=OFF - however this will not work as expected when using 
a
connection pool (the connection pool manager will re-enable autocommit when 
returning
 the connection to the pool, so autocommit will only be disabled the first time the
connection is used).

-----------

Therefore, I'm setting the bug to "Won't Fix"

Original comment by thomas.t...@gmail.com on 19 Apr 2010 at 5:14

GoogleCodeExporter commented 9 years ago
Totally fair.  Thanks.

Original comment by joe.witt on 20 Apr 2010 at 1:31