Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7508081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:37:01+00:00 2026-05-29T22:37:01+00:00

I would like to find out if my database is running or not from

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:37:01+00:00Added an answer on May 29, 2026 at 10:37 pm

    Triggers are typically server-side constructs; so to “fire a trigger” you would need to be able to connect to the DB in the first place, which would require it to be up, which doesn’t help.

    What is your motivation for “checking if the server is up”? Does it crash that often, or are you trying to be extra-careful before executing a database call that the DB has not crashed or your network connection lost?

    If it is the second reason, assuming you are using the Java Oracle Driver, you’ll just get an exception from the failed call.

    Code your calls to catch those exceptions and re-attempt the connection for retrying the call. This way you don’t need to poll the database; you just respond to the (infrequent) event when the connection is dead.

    If you try 5 or so times to reconnect and cannot, then you could notify the caller that the database is dead and send an email to your admin or something.

    There are any number of strategies here, but the point being that if you are trying to ensure calls execute, just wait for the java driver to fail and tell you instead of polling the DB server on a separate thread. No need for that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to find out if any and which database links are being
I have a Java application and I would like to find out the location
I would like to find out safe ways of implementing three dimensional arrays of
I would like to find out if a particular python datetime object is older
I would like to find out where I would be able to find the
I would like to find out what is the most significant differences of MS
I would like to find out, in JavaScript, which element currently has focus. I've
Using reflection on a method definition I would like to find out if the
Hi I am new to AspectJ and I would like to find out if
I've connected to a MySQL database using Perl DBI. I would like to find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.