The JDBC protocol does not provide a natural
connectionErrorOccured() event when a connection is broken. There are a number of plugins available to support dead/broken connection checking.
The simplest option is to run an SQL statement like the following before handing the connection to the application.
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
If this fails, another connection is selected until there are no more connections at which point new connections are constructed.
The potentially more performant check is to use vendor specific features, such as Oracle's or MySQL's
pingDatabase(), with the <valid-connection-checker-class-name/> element.