https://issues.apache.org/bugzilla/show_bug.cgi?id=53523
Priority: P2
Bug ID: 53523
Assignee: [email protected]
Summary: rollbackOnReturn/commitOnReturn does not work without
defaultAutoCommit=false
Severity: critical
Classification: Unclassified
OS: Linux
Reporter: [email protected]
Hardware: PC
Status: NEW
Version: unspecified
Component: jdbc-pool
Product: Tomcat Modules
Hi,
The properties rollbackOnReturn and commitOnReturn, which are critical for
cleaning up connections after they are used and returned to the pool, does not
work when the defaultAutoCommit property is not set or when it is set to true.
The code segment at ConnectionPool class has this,
protected boolean terminateTransaction(PooledConnection con) {
try {
if (con.getPoolProperties().getDefaultAutoCommit()==Boolean.FALSE)
{
....
The full logic is wrapped in that first if statement, and as I see, that is not
correct. Because, the actual default auto commit value when we don't set this
property can either be autoCommit true or false, which depends on the database
driver. And also, even when we have a default setting provided, the user has
the freedom to change the autoCommit flag to either true or false at the
beginning when they get the connection from the pool. So we should not be
reading the pool properties in this place, but just check the current live
connection's autoCommit value and act accordingly. So I suppose the fix should
be to simply remove the outer if statement.
Cheers,
Anjana.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]