Change Notification component

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
swm4
Posts: 8
Joined: Wed 17 Dec 2008 22:48

Change Notification component

Post by swm4 » Wed 17 Dec 2008 22:56

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.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 19 Dec 2008 09:43

The user registering the queries must be granted the CHANGE NOTIFICATION privilege.

swm4
Posts: 8
Joined: Wed 17 Dec 2008 22:48

Post by swm4 » Fri 19 Dec 2008 16:11

The Oracle user has that privilege.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 22 Dec 2008 09:47

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

swm4
Posts: 8
Joined: Wed 17 Dec 2008 22:48

Post by swm4 » Tue 23 Dec 2008 16:40

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 24 Dec 2008 09:21

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.

Post Reply