Oracle Change Notification: ORA-29970

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
schueler
Posts: 17
Joined: Tue 17 May 2005 15:44
Location: Germany
Contact:

Oracle Change Notification: ORA-29970

Post by schueler » Tue 15 Jul 2008 14:10

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();
            }
        }

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 16 Jul 2008 13:42

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

schueler
Posts: 17
Joined: Tue 17 May 2005 15:44
Location: Germany
Contact:

Post by schueler » Thu 17 Jul 2008 07:55

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?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 17 Jul 2008 11:59

Hello, Rainer.

The requested functionality will be available in the next build.

Regards, Andrey.

Post Reply