views:

275

answers:

1

I have an Oracle Connection to a ORACLE 10.2 database and want to listen for changes to a table. The user of the connection was granted the privilege "CHANGE NOTIFICATION".

Listening is initialized with the following method:

private OracleDependency SubscribeToTable(string tableName)
{
  string sql = "select * from " + tableName;
  var cmd = new OracleCommand(sql, this.connection) { AddRowid = true };
  var dep = new OracleDependency(cmd);
  cmd.Notification.IsNotifiedOnce = false;
  dep.OnChange += this.dep_OnChange;
  cmd.ExecuteNonQuery();
  return dep;
}

When i insert a row into the observed table and commit, the event dep_OnChange is never fired. What am i doing wrong?

UPDATE:

After checking the troubleshooting list and found everything to be OK, i connected as DBA to Oracle and checked the ip adresses that should be notified when a change occurs (SELECT * FROM user_change_notification_regs). For some reason the ip addresses pointed to a VMWare virtual network adapter, although the notification request was initiated from the physical machine and not a VM. After disabling that virtual network adapter, everything works like it should.

+3  A: 

Have you run through the trouble shooting in the documentation?

Matthew Watson