[jboss-user] [JCA/JBoss] - Re: jboss connectionpooling by subject, connection closed/no
do-not-reply at jboss.com
Mon Apr 6 10:04:26 EDT 2009
"gjeudy" wrote :
| I'm considering adding a check-valid-connection-sql config something like:
| SELECT * FROM DUAL
That will only help when you first get the connection from the pool.
i.e. at the start of a new tranaction.
anonymous wrote :
| Even if that worked wouldn't that add unnecessary overhead? I mean shouldn't jboss find such unrecoverable exceptions by itself and let go the physical connection handle
It obviously has done, that is why you have the connection closed message
most likely spotted by the OracleExceptionSorter you've configured.
anonymous wrote :
| and recreate a new one ?
It does, but you have to let the transaction rollback and start it over again
which will retrieve a "new" connection from the pool.
It can't recover mid-transaction.
The connection remains "sticky" to the transaction even when it has errored and closed.
The transaction is dead, the loss of the physical connection means you can
no longer access the local transaction state within the database.
Opening a new connection to take over from the failed one
won't give you access to that state so you could never commit it
or if you tried you would miss committing part of the data.
So what you need is to have some code at whatever starts and ends the transaction
that spots the SQLException (or any other retryable exception) and retry it.
If you were using EJB/CMT then JBoss has a way to configure your own
retry handlers that are transparent to the application:
Other frameworks may or may not have their own approach?
Either way, the retry policy for a failed transaction is not something that
can or should be configured at the DataSource level it's an application policy.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223686#4223686
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223686
More information about the jboss-user