I would like to find out if my database is running or not from my java code. I am not sure what approach will work best. The most obvious one is to have a thread that periodically polls the database. Another approach would be to use Triggers. I am not well versed in triggers, but i know that you can fire the trigger for updates, inserts and deletes. But, is it possible to fire the trigger when the database is down? It makes no sense to me trigger would work when the database is down. 

PS: The database we are using right now is oracle, but I believe the same solution can be applied to any database

Thanks