title: querying DB in a loop continuously in java
body: <p>Is it advisable to query a database continuously in a loop, to get any new data which is added to specific table?</p>
  
  <p>I have below a piece of code:</p>
  
  <pre><code>  while(true)
        try{
           // get connection
           // execute only "SELECT" query
         }
        catch(Exception e){}
        finally{// close connection
  
        }
           //Sleep 5 sec's
        }
  </code></pre>