Page 1 of 1

Change Notification component

Posted: Wed 17 Dec 2008 22:56
by swm4
Is there anyone with experience using TOraChangeNotification? I'm having trouble getting it to work.

Here's what I am doing:
In the IDE, I placed this component on a form, wrote a simple ShowMessage line in the OnChange event and attached the component to a TOraQuery. In the form's OnShow event, I open an Oracle session and open the query. Then I run my app.

I then go to SQL Plus and update data in the table that the TOraQuery in my app has queried. I commit the change in SQL Plus. The OnChange event in my code never runs.

I'm using ODAC 6.50.0.39 against a 10g database.

Posted: Fri 19 Dec 2008 09:43
by Plash
The user registering the queries must be granted the CHANGE NOTIFICATION privilege.

Posted: Fri 19 Dec 2008 16:11
by swm4
The Oracle user has that privilege.

Posted: Mon 22 Dec 2008 09:47
by Plash
Maybe the following information can help:

To use the change notification functionality, the JOB_QUEUE_PROCESSES initialization parameter must be set to a none-zero value.

Code: Select all

ALTER SYSTEM SET job_queue_processes=1

Posted: Tue 23 Dec 2008 16:40
by swm4
The parameter is set to 1 and still no success.

Here are the relevant excerpts from the pas and dfm files (the db username and passwords have been removed).
procedure TForm1.FormShow(Sender: TObject);
begin
Session.Connect;
Qry.Open;
end;

procedure TForm1.OraChangeNotification1Change(Sender: TObject;
NotifyType: TChangeNotifyEventType; TableChanges: TNotifyTableChanges);
begin
ShowMessage('foo');
end;


object Session: TOraSession
Options.KeepDesignConnected = False
Server = 'ced'
Connected = True
LoginPrompt = False
Left = 32
Top = 88
end
object Qry: TOraQuery
Session = Session
SQL.Strings = (
'SELECT *'
' FROM accounts')
ChangeNotification = OraChangeNotification1
Active = True
Left = 128
Top = 88
end
object OraChangeNotification1: TOraChangeNotification
OnChange = OraChangeNotification1Change
Left = 224
Top = 88
end

Posted: Wed 24 Dec 2008 09:21
by Plash
Change Notification may not work with some configurations of Oracle server. You can test Change Notification using PL/SQL code instead of ODAC components to see if the problem is related to ODAC. You can find information about using Change Notification in PL/SQL in the Oracle documentation.