我没有运气从数据库服务器获取更改通知。我的本地防火墙已关闭。我们想知道是否有任何其他环境/机器设置会阻止更改通知返回?
我的用户对数据库具有CHANGE NOTIFICATION权限。服务器是11.2.0.2.0,ODP.NET文件是2.112.1.2。
var con = new OracleConnection(constr);
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...");