Setting up JBoss to auto reconnect after database outage
If you had a database outage or failure while JBoss was up, you’re likely in a situation where you would have to restart JBoss because the database connections didn’t get reconnected for you. You’re likely also faced with a massive set of log files due to the data source complaining about it not being able to connect to the database.
If you want JBoss to automatically reconnect the data source pool(s) for you, here’s some settings to use (only valid if using a “local-tx-datasource”):
2) <check-valid-connection-sql>an efficient select statement</check-valid-connection-sql>
In the above settings, if the data source connectivity is lost (database down or network failure) – then JBoss will automatically attempt to reconnect 50 times every 15 seconds. You can obviously set those numbers to values suitable to your environment. It’s also important to set the failOverReadOnly flag to false as it ensures that recovered connections are writable.
Additionally, some people prefer to include a valid and efficient SQL statement in the “check-valid-connection”, it’s completely optional but a good practice in environments where stale connections are common. Optionally, there’s also “new-connection-sql” which will check on newly created connections.
Original article at http://blogs.adobe.com/livecycle/2011/03/setting-up-jboss-to-auto-reconnect-after-database-outage.html.
Comments are closed.