Bear in mind this is RDBMS-specific. It's possible in Oracle, but necessarily so with other DBs
Main Topics
Browse All TopicsIn JTAPI, you can monitor on a terminal. When a terminal is being turned off/on, you would get an event in terminalChangedEvent.
I would like to develop same kind of logic like this, but it is against an SQL Server. I want to monitor on a SQL Server's table. If there was a row added or deleted, I would like to raise an event in a method call rowChangedEvent. I should have a event list that includes add and delete:
public synchronized void rowChangedEvent(some kind of event list)
{
switch (event list)
{
case add:
Do something.
case delete:
Do something.
}
}
I don't have a clue how to do it. I hope experts can give me some advice. Sample code will be appreciated. Thanks !
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi nicolle,
If your SQL server has this kind of feature, you won't be able to use it with Java.
But you can build a SQL filter server :
Instead of:
SQL client application <-> SQL Server
You can do:
SQL client application <-> SQL filter server <-> SQL Server
The SQL filter server should detect any modification query on tables and notify your application (using Socket for example) if the query is successfull.
I see ! The reason I want to raise an event when a row is added or deleted in java is to learn how to implement the event handling. Maybe I should change it to the following:
Monitor on a directory to detect if a file is added or deleted:
public synchronized void fileChangedEvent(some kind of event list)
{
switch (event list)
{
case add:
Do something.
case delete:
Do something.
}
}
Here's some code for monitoring a directory for changes:
http://www.experts-exchang
It's not really clear what you want:
>>is to learn how to implement the event handling.
>>I would like to listen for some events
suggests two related, but different, things really. If it's just the second one you want to do
JButton b = new JButton("Click me!");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEven
System.out.println("I've been clicked");
}
});
will fit the bill. You are listening for events on the button.
It you want to study how event handling is *implemented* the best way is to create your own events as you will then need to work through each element in the event handling mechanism, including how listeners are added, how they are notified, etc.
The second link is a relatively complex example with little commentary. This outlines the mechanisms involved in custom events much more clearly:
http://www.javaworld.com/j
Listen for the WindowClosing event see
http://javaalmanac.com/egs
> I think addShutdownHook is very useful to do some action before terminating the app.
Use with care though thats not what they are really intended for.
Thanks for the points :)
http://www.objects.com.au/
Business Accounts
Answer for Membership
by: CEHJPosted on 2004-03-18 at 13:01:20ID: 10627630
You need to write a database trigger. See http://www.csee.umbc.edu/h elp/oracle 8/java.815 /a64686/ 04 _call2.htm