[jboss-jira] [JBoss JIRA] Updated: (JBAS-3879) org.jboss.resource.adapter.jdbc.WrappedConnection does not handle early rollbacks properly
David Kilzer (JIRA)
jira-events at jboss.com
Wed Nov 22 17:13:41 EST 2006
[ http://jira.jboss.com/jira/browse/JBAS-3879?page=all ]
David Kilzer updated JBAS-3879:
-------------------------------
Description:
When an "early" rollback is performed (see code example below) using a java.sql.Connection from a JBossAS-managed DataSource, the following stack trace is produced:
java.sql.SQLException: rollback() should not be called while in auto-commit mode.
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.rollback(ConnectionJDBC2.java:1989)
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcRollback(BaseWrapperManagedConnection.java:535)
at org.jboss.resource.adapter.jdbc.WrappedConnection.rollback(WrappedConnection.java:460)
at package.MyClass.testWrappedConnectionBehavior(MyClass.java:71)
[...]
However, when this same code is run without using a JBossAS-managed DataSource, it works with no SQLException being thrown:
private void testWrappedConnectionBehavior(DataSource dataSource) {
Connection connection = null;
try {
connection = dataSource.getConnection();
connection.setAutoCommit(false);
connection.rollback(); // line 71
}
catch (SQLException e) {
e.printStackTrace(System.err);
}
finally {
if (connection != null) {
try {
connection.close();
}
catch (SQLException ignored) {
}
}
}
}
The org.jboss.resource.adapter.jdbc.WrappedConnection class should be able to handle an early rollback properly.
This issue originally filed with Spring: http://opensource.atlassian.com/projects/spring/browse/SPR-2862
was:
When an "early" rollback is performed (see code example below) using a java.sql.Connection from a JBossAS-managed DataSource, the following stack trace is produced:
java.sql.SQLException: rollback() should not be called while in auto-commit mode.
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.rollback(ConnectionJDBC2.java:1989)
at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcRollback(BaseWrapperManagedConnection.java:535)
at org.jboss.resource.adapter.jdbc.WrappedConnection.rollback(WrappedConnection.java:460)
at package.MyClass.testWrappedConnectionBehavior(MyClass.java:71)
[...]
However, when this same code is run without using a JBossAS-managed DataSource, it works with no SQLException being thrown:
private void testWrappedConnectionBehavior(DataSource dataSource) {
Connection connection = null;
try {
connection = dataSource.getConnection();
connection.setAutoCommit(false);
connection.rollback();
}
catch (SQLException e) {
e.printStackTrace(System.err);
}
finally {
if (connection != null) {
try {
connection.close();
}
catch (SQLException ignored) {
}
}
}
}
The org.jboss.resource.adapter.jdbc.WrappedConnection class should be able to handle an early rollback properly.
This issue originally filed with Spring: http://opensource.atlassian.com/projects/spring/browse/SPR-2862
> org.jboss.resource.adapter.jdbc.WrappedConnection does not handle early rollbacks properly
> ------------------------------------------------------------------------------------------
>
> Key: JBAS-3879
> URL: http://jira.jboss.com/jira/browse/JBAS-3879
> Project: JBoss Application Server
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Management services
> Affects Versions: JBossAS-4.0.2 Final
> Environment: Microsoft Windows XP [Version 5.1.2600]
> java version "1.5.0_07"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)
> jTDS-1.2.0
> MS SQL Server 2000 SP4 (separate server running WIndows 2003 Server)
> Reporter: David Kilzer
> Assigned To: Dimitris Andreadis
>
> When an "early" rollback is performed (see code example below) using a java.sql.Connection from a JBossAS-managed DataSource, the following stack trace is produced:
> java.sql.SQLException: rollback() should not be called while in auto-commit mode.
> at net.sourceforge.jtds.jdbc.ConnectionJDBC2.rollback(ConnectionJDBC2.java:1989)
> at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcRollback(BaseWrapperManagedConnection.java:535)
> at org.jboss.resource.adapter.jdbc.WrappedConnection.rollback(WrappedConnection.java:460)
> at package.MyClass.testWrappedConnectionBehavior(MyClass.java:71)
> [...]
> However, when this same code is run without using a JBossAS-managed DataSource, it works with no SQLException being thrown:
> private void testWrappedConnectionBehavior(DataSource dataSource) {
> Connection connection = null;
> try {
> connection = dataSource.getConnection();
> connection.setAutoCommit(false);
> connection.rollback(); // line 71
> }
> catch (SQLException e) {
> e.printStackTrace(System.err);
> }
> finally {
> if (connection != null) {
> try {
> connection.close();
> }
> catch (SQLException ignored) {
> }
> }
> }
> }
> The org.jboss.resource.adapter.jdbc.WrappedConnection class should be able to handle an early rollback properly.
> This issue originally filed with Spring: http://opensource.atlassian.com/projects/spring/browse/SPR-2862
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list