Knowledge of data change in real time

HiJust wondering. I have a database connected to a GUI. Another independant program is adding records to the database. But is there a way for my GUI to monitor the database and know when these records are added, therefore updating the GUI display?ThanksMatt
[285 byte] By [europlana] at [2007-11-26 15:46:55]
# 1
Currently I can just think of querying the db perioduically, but then this would not be real time ... so was hoping there might be a method available to help with this.
europlana at 2007-7-8 22:06:20 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

> Currently I can just think of querying the db

> perioduically, but then this would not be real time

> ... so was hoping there might be a method available

> to help with this.

Yeah... no. There is no magic method.

You have a couple of options.

1) Polling. As you indicate here

2) Doing something else to get notified of updates. Like JMS. (Might be overkill for your needs).

No ready to roll method answer though.

cotton.ma at 2007-7-8 22:06:20 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Ah ... thanks for the quick response. Looks like polling it is :)
europlana at 2007-7-8 22:06:20 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

If you are using Oracle 10g r2 it provides database change notification which might be applicable to your situation. It doesn't do anything you cannot do by hand but simplifies the coding to nothing more then a single requery to look for changes even on multiple objects (works with DML and DDL changes). It doesn't change the fact you are polling, but you can implement faster due to less coding and less testing.

I doubt if Oracle has the market cornered on this type of functionality so you should check with your database vendor to determine if they have something simliar.

Here is a link to the Oracle documentation on Oracle database change notification:

http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_dcn.htm#ADFNS018

WorkForFooda at 2007-7-8 22:06:20 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...