Hey
Aaron Mulder wrote:
>
> You call that a spec of "moderate" length? Before long it's going
> to be more cost-effective for me to buy a duplex unit than to burn through
> more reams of paper... ;)
Aaah.. I remember the naive thinking when self discovered Java in -95. I
thought I could print out the JDK javadoc. My parents still remember
that very long day/evening/night...
> Anyway, it looks like if there is a current Transaction, the
> SQLException should be propagated to the Container, which should then
> commit or rollback the transaction.
Correct.
> In either case, with a JDBC 2.0
> driver the connection should be returned to the pool.
Correct.
> With the JDBC 1.0
> wrapper, the connection should be returned to the pool if there is no
> Transaction, and held pending commit or rollback if there is a
> Transaction.
Correct.
> So what if the SQLException happens *during* a commit or rollback?
> I would think in this case we probably want to assume that the connection
> is permanently damaged and take it out of the pool altogether.
In any case it should be disassociated with the tx. Thrown from the
pool? This should depend on the type of exception in a perfect world,
but the world isn't, so kill it...
> Perhaps
> that's only true for the 1.0 wrappers. But I have to think that if you,
> say, lost your network connection to the DB, it would cause an exception
> during normal operation. Then you'd try to rollback, and get another
> exception. So I think we want to assume that an error during rollback
> means a connection is *dead*, and probably the same for a commit.
Good thinking.
> I guess this is only a problem for the 1.0 wrappers. In the case
> of a true JDBC 2 driver, we never call commit or rollback on the
> Connection - rather, the TransactionManager calls it on the XAResource, so
> we're not really sure which XAConnections should be (or can safely be)
> closed. Even if you can get an XAConnection from the XAResource (given
> the 1 to 1 mapping), it may already be in use by another client, etc.
With JDBC 2.0 compliant XA drivers thou shall use
ConnectionEventListener to decide when to remove connections from da
pool.
/Rickard
--
Rickard �berg
@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com