[
http://jira.jboss.com/jira/browse/JBAS-5678?page=comments#action_12418922 ]
Adrian Brock commented on JBAS-5678:
------------------------------------
We won't wait until JavaEE6 (JDK4) if JDBC4 says the behaviour was never defined.
Especially if Oracle is doing the "wrong thing".
The patch is as follows if you want to try it.
Index: src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnection.java
===================================================================
--- src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnection.java (revision
74899)
+++ src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnection.java (working
copy)
@@ -222,20 +222,30 @@
public void destroy() throws ResourceException
{
synchronized (stateLock)
{
destroyed = true;
}
cleanup();
try
{
+ // See JBAS-5678
+ if (underlyingAutoCommit == false)
+ con.rollback();
+ }
+ catch (SQLException ignored)
+ {
+ getLog().trace("Ignored error during rollback: ", ignored);
+ }
+ try
+ {
con.close();
}
catch (SQLException ignored)
{
getLog().trace("Ignored error during close: ", ignored);
}
}
public boolean checkValid()
{
I'm ignoring the SQLException because in most cases it WILL fail.
i.e. the connection is really broken during the destroy() attempt.
(and who cares about an error during a close anyway :-)
closed jdbc connection before transaction rollback is called
------------------------------------------------------------
Key: JBAS-5678
URL:
http://jira.jboss.com/jira/browse/JBAS-5678
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: JCA service
Affects Versions: JBossAS-4.2.1.GA, JBossAS-4.2.2.GA
Reporter: hezimmer
Assigned To: Adrian Brock
Fix For: JBossAS-4.2.3.GA, JBossAS-5.0.0.CR1
Database connection is closed before the transaction handler is able to initiate an
rollback on this connection.
Please take a look at forum entry:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=137613
Inside WrappedPreparedStatement method setDouble the Exception from underlying
jdbc-driver is thrown. In case of this example
with Double.NaN as parameter value, Oracle causes an IllegalArgumentException instead of
an SQLException.
Because of that BaseWrapperManagedConnection method connectionError is called:
Code:
void connectionError(Throwable t)
{
if (t instanceof SQLException == false || mcf.isExceptionFatal((SQLException) t))
broadcastConnectionError(t);
}
This Throwable isn't an instance of SQLException so it seems to be an
connection error and broadcastConnectionError is called which causes
unregisterConnections and so the connection on jdbc level is closed
without rollback. Because of that the insert1 statement is commited
because oracle jdbc commits on close. So the transaction handling is not correct.
--
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