mcevikce wrote:But even with <check-valid-connection-sql> defined, my old connections are still there. I would expect all of the old connections to be recycled but thats not the case.Is there a way to clear all the connections in my datasource and recreate them with new URL?
Actually you are not using ha datasource, it seems the URL gets changed on the fly.
The DB connections available in the pool are alive, the check-valid-connection when called will basically take longer time since the DB is locked, it is not closed/shutdown. If it would have been closed/shutdown I would have recommended you to try <use-fast-fail> as mentioned here
In your case I would suggest you to write a custom MBean which will flush the pool by invoking flush() operation on one of the JCA infrastructure MBeans, check jboss.jca:* Mbeans ( ManagedConnectionPool::flush()).