1

I am using OracleDependency to receive notification when a DB changes. How do I change the notification timeout to an unlimited number of seconds?

Jeff Holt
  • 2,940
  • 3
  • 22
  • 29
JimmyN
  • 579
  • 4
  • 16

1 Answers1

0

According to Oracle, the way you specify the timeout depends upon the constructor you use when creating the OracleDependency object.

If you use OracleDependency (OracleCommand cmd), then the constructor sets the cmd.Notification property to a new OracleNotificationRequest that it creates. After the constructor returns, you have set cmd.Notification.Timeout to 0.

If you use OracleDependency (OracleCommand cmd, bool isNotifiedOnce, long timeout, bool isPersistent), then you specify a 0 for the timeout parameter.

If you use OracleDependency (), then no OracleCommand is associated with the new object and so whatever you do, you would do after you call the new object's AddCommandDependency(OracleCommand cmd) method. This means you would set cmd.Notification.Timeout to 0.

The default value for the Timeout is 50,000 seconds so you have plenty of time to modify the Timeout before the registration expires.

Jeff Holt
  • 2,940
  • 3
  • 22
  • 29
  • This is the answer I want, thank you. And I still have another question, if I let it run 24/ 24 whether it affects the performance of the database or not? And how to cancel it when the application is shut down – JimmyN Jul 09 '17 at 12:06
  • Actually, it's two questions and they both deserve their own post because I saw no question about how to cancel and the [cancel post](https://stackoverflow.com/questions/7307443/odp-net-db-change-notification) does *not* do justice to demonstrating a performance problem. I suspect the cancel question is pretty intuitive or obvious in the docs but answering questions in comments is bad for everyone. Doing it the right way means searching for answers yourself first and only after not finding, then you ask. – Jeff Holt Jul 09 '17 at 14:37