If you are using one of the matured Databases, then you should have the option of database triggers. You can configure a trigger for the expected table and let the trigger communicate the change to your java program. In this way you are using the inherent feature supported by the database (Which is obviously performance effective) and also reducing the load on the application or the web server.
For how to use java in Oracle triggers see the following link
Dwarka Damodaran wrote:...You can configure a trigger for the expected table and let the trigger communicate the change to your java program. ...
If I'm not mistaken, the page you link to shows how to call Java Stored Procedure on Oracle. It still takes some (or lots of) work to remotely call Java on a webserver from that, for example.
However, starting at version 10g, Oracle offers a Database Change Notification functionality for exactly this purpose. I should say we had some troubles getting it to work and currently do not use it, but it might be caused by the fact that our tables were modified quite often and by "big" transactions. We'll probably retry when we'll finish moving to 11g.
Oracle 11g offers lots of new features, eg. the client result cache (if the answer to a query is not modified, the client does not go into database, but uses the cached result), which allows for effective polling mechanisms to be employed. Might be easier than battling with Database Change Notification. I'm not sure whether an JDBC OCI client would not be needed for this, though.
But your main point is true, Oracle has tools specifically designed for this and other databases might offer similar features. It is definitely good idea to check them out.