[
http://jira.jboss.com/jira/browse/JBAS-5678?page=comments#action_12418916 ]
Adrian Brock commented on JBAS-5678:
------------------------------------
"because oracle jdbc commits on close."
That's madness. What's the point of setAutocommit(false)
if the jdbc driver is going to commit silently anyway? :-)
Anyway, after some research I found this addition to the javadocs in JDK6 (JDBC 4)
http://java.sun.com/javase/6/docs/api/java/sql/Connection.html#close()
"
It is strongly recommended that an application explicitly commits or rolls back an active
transaction prior to calling the close method. If the close method is called and there is
an active transaction, the results are implementation-defined.
"
NOTE: JBoss4 actually implements JDBC 3, but the comment is obviously meant to be
retrospective.
The JavaEE semantics are much better defined. If you don't commit or rollback
after starting a local transaction and close() the connection handle (of any type, not
just a jdbc connection)
you get an error and a rollback is done for you. See JCA-1.5, Section 7.8.1 -
LocalTransactionCleanup
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.2.GA, JBossAS-4.2.1.GA
Reporter: hezimmer
Assigned To: Jesper Pedersen
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