Page 1 of 1

Oracle Change Notification: ORA-29970

Posted: Tue 15 Jul 2008 14:10
by schueler
Hello,

when I try to use the change notification feature I will receive following error message:
ORA-29970: Angegebene Registrierungs-ID ist nicht vorhanden

Please see the attached file, maybe I am using this feature wrong. Is there any documentation for this feature or sample code. I didn't find any with my installation. Can you please help me? I am are using CoreLab.Oracle.dll version 4.70.37.0

Thanks,
Rainer

Code: Select all

            OracleDependency.Port = oracleChangeNotifierDef.Port;
            using(OracleCommand oracleCommand = Utils.CreateOracleCommand(this, oracleChangeNotifierDef.Command))
            using(OracleDependency oracleDependency = new OracleDependency(oracleCommand))
            {
                OracleNotificationRequest notification = oracleCommand.Notification;
                notification.IsNotifiedOnce = oracleChangeNotifierDef.TimeoutCount == 1;
                notification.IsPersistent = oracleChangeNotifierDef.IsPersistent;
                notification.RowLevelDetails = oracleChangeNotifierDef.RowLevelDetails;
                notification.Timeout = oracleChangeNotifierDef.GetTimeoutSeconds();
                //Activate the notifier and wait until is is elapsed
                oracleDependency.OnChange += OracleDependency_OnChange;
                oracleCommand.ExecuteScalar();
                WaitElapsed();

Code: Select all

        private void OracleDependency_OnChange(object sender, OracleNotificationEventArgs args)
        {
            try
            {
                Dictionary parameters = new Dictionary();
                parameters.Add("Type", args.Type);
                DataTable dataTable = args.Details;
                if(dataTable != null)
                {
                    DataSet dataSet = new DataSet();
                    dataSet.Tables.Add(dataTable);
                    using(StringWriter stringWriter = new StringWriter())
                    {
                        dataSet.WriteXml(stringWriter, XmlWriteMode.WriteSchema);
                        parameters.Add("Details", stringWriter.ToString());
                    }
                }
                Activate(parameters);
            }
            catch(Exception exception)
            {
                Log.Error(string.Format("Error activating trigger: {0}", def.Caption), exception);
                if(!def.ContinueOnException) SetElapsed();
            }
        }

Posted: Wed 16 Jul 2008 13:42
by AndreyR
Hello, Rainer.

This feature is available since Oracle 10.2.0.2.
Please specify your version, that can be the point.
OracleDependency sample is available here:

%Program Files%\CoreLab\OraDirect .NET2\Samples\WinForms\CSharp.sln

Regards, Andrey Rudenko

Posted: Thu 17 Jul 2008 07:55
by schueler
Looking at the problem with DbMonitor revealed that Oracle has thrown internally an other error: ORA-29972: Benutzer hat keine Berechtigung, die Registrierung zu ändern / zu erstellen
This indicates that the database user does not have the permission to register change notification. The following command solved this issue:
grant change notification to xyz;

Is it possible for the class to get the original error message form Oracle?

Posted: Thu 17 Jul 2008 11:59
by AndreyR
Hello, Rainer.

The requested functionality will be available in the next build.

Regards, Andrey.