Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>I am wondering if this is a good practice?</p> </blockquote> <p>No. It's not good. Sometimes, it's all you've got, but it's not good.</p> <blockquote> <p>And, what could be a more efficient way to implement this?</p> </blockquote> <p>How do things get into the database in the first place? </p> <p>The best change is to fix programs that insert/update the database to make requests which go to the database and to your program. A JMS topic is good for this kind of thing.</p> <p>The next best change is to add a trigger to the database to enqueue each insert/update event into a queue. The queue could feed a JMS topic (or queue) for processing by your program.</p> <p>The fall-back plan is your polling loop.</p> <p>Your polling loop, however, should not trivially do work. It should drop a message into a queue for some other JDBC process to work on. A termination request is another message that can be dropped into the JMS queue. When your program gets the termination message, it absolutely must be finished with the prior JDBC request and can stop gracefully.</p> <p>Before doing any of this, look at ESB solutions. Sun's <a href="http://www.sun.com/software/javaenterprisesystem/javacaps/index.jsp" rel="noreferrer">JCAPS</a> or <a href="http://www.tibco.com/" rel="noreferrer">TIBCO</a> already have this. An open source ESB like <a href="http://www.mulesource.org/display/MULE/Home" rel="noreferrer">Mulesource</a> or <a href="http://www.jitterbit.com/" rel="noreferrer">Jitterbit</a> may already have this functionality already built and tested.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload