I'm not having any luck getting the change notification back from the DB server. My local firewall is off. We're wondering if there are any other environmental/machine settings that would be preventing the change notification from returning?
My user has CHANGE NOTIFICATION rights on the database. Server is 11.2.0.2.0 and ODP.NET files are 2.112.1.2.
var con = new OracleConnection(constr);
开发者_StackOverflow中文版 OracleDependency dep = null;
var cmd = new OracleCommand("select col1, col2, col3 from gline.test", con);
con.Open();
//OracleDependency.Port = 1005;
dep = new OracleDependency();
dep.OnChange += new OnChangeEventHandler(OnMyNotificaton);
dep.QueryBasedNotification = false;
dep.AddCommandDependency(cmd);
cmd.Notification.IsNotifiedOnce = false;
cmd.AddRowid = true;
cmd.ExecuteNonQuery();
var txn = con.BeginTransaction();
string updateCmdText = "update gline.test set col1 = 1, col2 = 2, col3 = 3 where col1 = 1";
OracleCommand updateCmd = new OracleCommand(updateCmdText, con);
updateCmd.ExecuteNonQuery();
txn.Commit();
Console.WriteLine("updated gline.test");
Console.WriteLine("Waiting for change notification...");
精彩评论