I want to make an application that has push notifications, using OracleDependency, I follow the instructions in the documentation.
I execute the following commands:
grant change notification to SN_Hospitales;
GRANT EXECUTE ON DBMS_CHANGE_NOTIFICATION TO SN_Hospitales;
and I have the following code:
var Entidad= "sn_hospitales.entidad_dependency";
var login = "DATA SOURCE=(DESCRIPTION = " +
" (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.54.170)
(PORT = 1521)) " +
" (CONNECT_DATA = " +
" (SERVER = DEDICATED) " +
" (SERVICE_NAME = SERUD) " +
" )) ; USER ID=SN_Hospitales;PASSWORD=XXXXXX";
OracleConnection con = new OracleConnection(login);
con.Open();
OracleDependency dependency = new OracleDependency();
OracleCommand cmd = con.CreateCommand();
string sql = "select nombre from " + Entidad;
cmd.CommandText = sql;
dependency.OnChange += new OnChangeEventHandler(dep_OnChange);
dependency.AddCommandDependency(cmd);
cmd.Notification.IsNotifiedOnce = false;
cmd.AddRowid = true;
cmd.ExecuteNonQuery();
But it does not work, can someone help me if I leave something or something has to be done in the Oracle?
thanks