Hi,
we are using the esql taglib. There we realized some strange behavior concerning
autocommit.
Conclusion:
If you want to set autocommit to false, you have to state
"<esql:autocommit>false</esql:autocommit>"
in every esql:connection you use!
Not stating "<esql:autocommit>false</esql:autocommit>" in a esql:connection
resets autocommit to true!
Explanation:
We are using the "jdbc/auto-commit" element in cocoon.xconf to state wether we
need autocommit or not.
In the esql-queries we do not use the "esql:autocommit" element at all.
Now it seems that autocommit is only deactivated if the "esql:autocommit"
element is present and does contain "false".
In every other case, autocommit is set to true (even if the jdbc connection
says "<auto-commit>false</auto-commit>").
In the xsl-code of the esql-taglib (the source is from cocoon 2.0.2) I found
the following:
<xsl:template match="esql:connection">
...
<xsl:variable name="autocommit"><xsl:call-template
name="get-nested-string"><xsl:with-param name="content"
select="esql:autocommit"/></xsl:call-template></xsl:variable>
...
try {
if ("false".equals(String.valueOf(<xsl:copy-of select="$autocommit"/>)))
{
if (_esql_connection.getAutoCommit()) {
_esql_connection.setAutoCommit(false);
}
} else {
if (!_esql_connection.getAutoCommit()) {
_esql_connection.setAutoCommit(true);
}
}
...
</xsl:template>
I think, the "else"-clause is the problem:
If "esql:autocommit" is not "false", then autocommit will be set to true!
So this means, even when the jdbc connection states
"<auto-commit>false</auto-commit>" it will be set to true,
if no element "<esql:autocommit>false</esql:autocommit>" is present.
With best wishes and hopefully no more unwanted commits
Christoph Oberle
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>