-
Hallo,
Code:
ILE ist deshalb besser, da du hier eine eigene ACTGRP definieren kannst um mit *INLR = *OFF den Trigger nicht ständig zu initialisieren.
Trigger (egal ob extern oder SQL) sollten niemals in einer eigenen/benannten Aktivierungsgruppe, sondern immer in Aktivierungsgruppe *CALLER laufen!
Grund ist Commitment Control und Transaktions-Sicherheit.
Ein Trigger hängt direkt an einer physischen Datei oder Tabelle (oder seit V5R4 an einer View). Es erfolgt ein Update in einem Programm in Aktivierungsgruppe X. Der Update aktiviert den Trigger in einer eigenen Aktivierungsgruppe Y. Update und Trigger-Aktion gehören zusammen, d.h. Update und Trigger müssen beide ausgeführt werden oder keines von beiden. Die Commitment-Steuerung ist mit Standard-Werten (also Commitment Scope *ACTGRP) gestartet.
Und jetzt ist ein Rollback erforderlich.
.... und der funktioniert nur innerhalb der Aktivierungsgruppe, in der er abgesetzt wurde!
... schade aber auch!
Auszug aus Redbook: Stored Procedures, Triggers and User Defined Functions (Kapitel 11.3.1. Commitment Control and Triggers):
To ensure the best level of data consistency, use commitment control in your applications. If your database design includes triggers, be aware of the implications of using commitment control for the resources accessed by the trigger programs. To avoid data integrity potential exposures, triggers and applications should share the same commitment definition. In this case, all the changes performed by triggers are committed or rolled back by the application
itself. The safest way to ensure that this happens is by compiling your triggers with ACTGRP(*CALLER). Triggers and applications should also share the same lock level.
If triggers run in a separate commitment control definition, they must commit or roll back their changes, since the application cannot do that. There are potential record-locking and consistency exposures in this situation. If the trigger terminates normally without committing its changes, the application cannot release the locks on those records.
Birgitta
Similar Threads
-
By WeKaSys in forum IBM i Hauptforum
Antworten: 3
Letzter Beitrag: 06-11-06, 17:34
-
By jo400 in forum IBM i Hauptforum
Antworten: 1
Letzter Beitrag: 21-10-06, 17:57
-
By M Scheid in forum NEWSboard Programmierung
Antworten: 8
Letzter Beitrag: 18-01-06, 12:50
-
By tinewww in forum IBM i Hauptforum
Antworten: 4
Letzter Beitrag: 22-07-04, 11:32
-
By sannefinger in forum IBM i Hauptforum
Antworten: 3
Letzter Beitrag: 17-05-04, 15:19
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks