Database Change Notification using Java ojdbc5 not working

156 views Asked by At

I'm testing the database change notification feature in Oracle using the sample code in their documentation (here)

Before running the program, I ran this command in the database:

grant change notification to [USER];

After starting the program, I query table USER_CHANGE_NOTIFICATION_REGS in the database and got this row

306 4   net8://(ADDRESS=(PROTOCOL=tcp)(HOST=10.5.1.6)(PORT=47632))?PR=0 0   0   4294967295  [SCHEMA].[TABLE]

where schema and table specify the user and table to which I'm registering.

However, after running some update commands in the table, the code specify in the onDatabaseChangeNotification does not execute, even after a few minutes.

Have you guys encounter such problems?

1

There are 1 answers

0
vudangkhoa2906 On

I found the problem.

It is specified in the example that

// if connected through the VPN, you need to provide the TCP address of the client.
// For example:
// prop.setProperty(OracleConnection.NTF_LOCAL_HOST,"14.14.13.12");

The problem was that I connect with my database via VPN