---- On Fri, 12 Mar 2021 02:35:27 -0500 Mark Thomas <ma...@apache.org> wrote 
----

 > On 12/03/2021 03:57, My Subs wrote: 
 > > Hello, 
 > > 
 > > I'm using Tomcat 10.0.0.  Suppose I call setAutoCommit(false) on a 
 > > connection obtained from a Tomcat JDBC Connection Pool.  Then I do some 
 > > stuff with the connection, call commit() or rollback() and finally call 
 > > close() on it without ever calling setAutocommit(true). 
 > > 
 > > What will the autocommit state of that connection be, the next time the 
 > > pool gives it to my code?  Will it be in the same state I left it, that 
 > > is, with autocommit set to false, or will it be reverted back to the 
 > > default state (autocommit set to true)? 
 >  
 > The simplest way to be sure is to run a test with a pool size of 1. 
 >  
 > A quick look at the code (I might have missed something) suggests that 
 > if defaultAutoCommit is configured then it will be reset to that default 
 > value. Otherwise it will be unchanged from when the connection was 
 > returned to the pool. 
 >  
 > Mark 
 >  
 > --------------------------------------------------------------------- 
 > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org 
 > For additional commands, e-mail: users-h...@tomcat.apache.org

Hi Mark,

Thanks for your comment.  I found this on 
https://tomcat.apache.org/tomcat-10.0-doc/jdbc-pool.html:

"The only state the pool itself inserts are defaultAutoCommit, defaultReadOnly, 
defaultTransactionIsolation, defaultCatalog if these are set. These 4 
properties are only set upon connection creation. Should these properties be 
modified during the usage of the connection, the pool itself will not reset 
them."

It seems to say that connections will not be reverted back to the default 
auto-commit state even if defaultAutoCommit is set.  Given your reading of the 
source code, might it be that the docs are wrong?

Thank you,

Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to