FSchumacher commented on issue #6090:
URL: https://github.com/apache/jmeter/issues/6090#issuecomment-1781784483

   Well, I think I know, what happens. We set the default autocommit value on 
the database pool. The pool initializes every connection we borrow from it with 
that value. When we set (default) autocommit to true and use the sampler 
autocommit (false), we set the autocommit flag for the borrowed connection, 
which immediately gets returned (with autocommit false). The next borrow 
operation re-sets the autocommit status to the default one.
   To work around this behaviour, you can use a JSR 223 Sampler which sets the 
default value for autocommit to `null`. That will keep the autocommit status on 
the connections through their entire lifetime.
   Note, that you will still have to set it for every connection the pool 
contains.
   The script for a database pool named `db` would look like
   ```groovy
   def dataSource = vars.getObject("db").configuredDataSource
   
   dataSource.defaultAutoCommit = null
   dataSource.autoCommitOnReturn = false
   ```
   This script should be the called before any other JDBC Sampler.
   I believe the JDBC Connection Config element should allow for `null`(or 
empty) value for the default autocommit value.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to