I have a "JDBC Connection Configuration" with autocommit=false. There are various JDBC Requests using this connection configuration. I've done some database traces and it looks like every JDBC request is commited. So the autocommit parameter on the "JDBC Connection Configuration" has no effect on the commit behaviour of the "JDBC Request".
Created attachment 20035 [details] set auto-commit configuration parameter at the same level as pool-controller I've checked this and you are right. There is a bug on the DataSourceElement.java . The code tries to se the "auto-commit" attribute as part of pool-controller but auto-commit doesn't belong to pool-controller it should be a sibling of pool-controller. This becomes clear taking a look to the excalibur-datasource-1.1.1.jar source code ResourceLimitingJdbcDataSource.java , more precisely the lines *** final Configuration controller = configuration.getChild( "pool-controller" ); *** final boolean autoCommit = configuration.getChild( "auto-commit" ).getValueAsBoolean( true ); Looking at those lines is evident that pool-controller and auto-commit are siblings and auto-commit shouldn't be added as a child of pool-controller I'm providing a patch attached that solves the issue.
(In reply to comment #1) By the way, Is there any possibility of replacing the excalibur connection pooling with more popular solutions as proposed in http://wiki.apache.org/jakarta-jmeter/Java14Proposals?
Created attachment 20036 [details] add the possibility of issuing commit and rollback toward the database If you set autocommit to false, it becomes imposible to issue commit and rollback instructions at least to databases that doesn't support COMMIT and ROLLBACK as statements. Those database require you to use conn.commit() and conn.rollback() instead. With this patch you can write commit or rollback in a JDBC Request and the JDBC Sampler will translate it to the correct .commit() or rollback() call.
(In reply to comment #3) > rollback instructions at least to databases that doesn't support COMMIT and > ROLLBACK as statements. Those database require you to use conn.commit() and > I'm talking about databases like Apache Derby here. The Derby JDBC driver doesn't allow stmt.execute("commit") but I think other JDBC drivers map such a call to an inner .commit() call.
(In reply to comment #3) > Created an attachment (id=20036) [edit] > add the possibility of issuing commit and rollback toward the database > If you set autocommit to false, it becomes imposible to issue commit and > rollback instructions at least to databases that doesn't support COMMIT and > ROLLBACK as statements. Those database require you to use conn.commit() and > conn.rollback() instead. With this patch you can write commit or rollback in a > JDBC Request and the JDBC Sampler will translate it to the correct .commit() or > rollback() call. The patch assumes that a script starting with "commit" or "rollback" contains nothing else. For databases that do allow commit and rollback statements this is unnecessarily restrictive. I think a different approach is needed for databases that don't support these commands.
(In reply to comment #1) > Created an attachment (id=20035) [edit] > set auto-commit configuration parameter at the same level as pool-controller > I've checked this and you are right. There is a bug on the > DataSourceElement.java . The code tries to se the "auto-commit" attribute as > part of pool-controller but auto-commit doesn't belong to pool-controller it > should be a sibling of pool-controller. This becomes clear taking a look to the > excalibur-datasource-1.1.1.jar source code ResourceLimitingJdbcDataSource.java > , more precisely the lines > *** final Configuration controller = configuration.getChild( "pool- controller" > ); > *** final boolean autoCommit = configuration.getChild( "auto-commit" > ).getValueAsBoolean( true ); > Looking at those lines is evident that pool-controller and auto-commit are > siblings and auto-commit shouldn't be added as a child of pool-controller > I'm providing a patch attached that solves the issue. OK, applied in r533871
I've added some new JDBC Sampler types: commit, rollback and autocommit on/off. These are in SVN r534651.
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1902