Reputation: 5199
I have an idea to create a little Java desktop application that displays notification when it finds a new record in an oracle db.
I don't want all the desktop clients to run the queries so what I was thinking I would do was create one main process which runs the queries and lets all the other processes know when to display a notification.
I am limited to Oracle 9i so I can't use change notification. AskTom says that dbms_alert is a good alternative for Oracle 9i.
So from what I'm thinking now is that I will write a sqlplus script to run via the crontab which will periodically run a query and then issue a dbms_alert.
For my desktop applications I'm a bit confused. dbms_alert has methods like waitany and waittone. Does that mean that my desktop applications need to keep live active sessions to the database open for them to received dbms_alerts?
Can't I just get my desktop applications to connect periodically to the db and pick up any alerts that they have not been picked up yet?
Thanks
Upvotes: 0
Views: 294
Reputation: 905
I would create a db job that executes the queries. Furthermore I would create a maintenance table where to leave a notification incl. timestamp if a new recored was found. Every (Java) client has its own timestamp from last query of the maintenance table and so would register if a new recored was found. But you have to make sure that every client makes a query to the maintenance table in a special period of time.
Upvotes: 1