Hello,
I have a .net web app with an Oracle back end and I need to audit my database. I created this template trigger that I was using on inserts, edit & deletes however... -
"CREATE OR REPLACE TRIGGER {0}.BIUD_{3}
-
BEFORE INSERT OR UPDATE OR DELETE ON {0}.{2}
-
REFERENCING OLD AS OLD NEW AS NEW
-
FOR EACH ROW
-
BEGIN
-
IF inserting THEN
-
SELECT {0}.{1}.nextval
-
INTO :NEW.{4}
-
FROM dual;
-
-
INSERT INTO {0}.{5}
-
({4}{6},
-
auditaction,
-
audituser,
-
auditdate)
-
VALUES (:NEW.{4}{7},
-
'INSERT',
-
substr(sys_context('userenv','os_user'), INSTR(sys_context('userenv','os_user'),'\')+1),
-
SYSDATE);
-
END IF;
-
-
IF updating THEN
-
INSERT INTO {0}.{5}
-
({4}{6},
-
auditaction,
-
audituser,
-
auditdate)
-
VALUES (:OLD.{4}{7},
-
'UPDATE',
-
substr(sys_context('userenv','os_user'), INSTR(sys_context('userenv','os_user'),'\')+1),
-
SYSDATE);
-
END IF;
-
-
IF deleting THEN
-
INSERT INTO {0}.{5}
-
({4}{6},
-
auditaction,
-
audituser,
-
auditdate)
-
VALUES (:OLD.{4}{8},
-
'DELETE',
-
substr(sys_context('userenv','os_user'), INSTR(sys_context('userenv','os_user'),'\')+1),
-
SYSDATE);
-
END IF;
-
END;
-
/"
-
I only get the username if I use impersonation and I restrict the web app to a user group (no anonymous login).
I have 1 oracle question and 1 .Net question.
Is it possible to get the correct username in Oracle without using impersonation?
If not, is there anyway I can configure .net so I don't have to use impersonation to send the user name?
If not I'm going to have to do my auditing at the application level, boooo.
1 2557
OK, to solve this I added ModifiedBy and IsDeleted Columns to all my tables.
In my DAL I set it up so that ModifiedBy is automatically set to the user I want.
I also changed my DAL to implement soft deletes and then my DAL automatically performs a hard delete after every soft delete. A soft delete is merely an update where the IsDeleted field is set to 1.
In my trigger I changed the audit username value to the modifiedby field that my dal passes. For deletes, I do the auditing on the soft delete that my DAL performs as that is the only opportunity to capture the user name.
This is a screwy fix to this problem, but it is a fix none the less.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: cxw0106 |
last post by:
Is there any way to implement File Auditing in .NET?
Thanks.
|
by: Roger Redford |
last post by:
Dear Experts,
I'm attempting to marry a system to an Oracle 817 datbase.
Oracle is my specialty, the back end mainly, so I don't
know much about java or javascript.
The system uses javascript to make ODBC calls to the db.
The particular system I'm working with, will not work
with an Oracle stored procedure I'm told. However, it
|
by: Paulo Jan |
last post by:
Hi all:
Let's say I'm designing a database (Postgres 7.3) with a list of all
email accounts in a certain server:
CREATE TABLE emails (
clienteid INT4,
direccion VARCHAR(512) PRIMARY KEY,
login varchar(128) NOT NULL,
|
by: RdR |
last post by:
Is it true that DB2 will have an auditing tool to be used for auditing
requirements such as Sarbanes-Oxley, etc? Something called Websphere
Compliance Auditing? Rumours have it that IBM has a new tool that will get
useful data for auditing from the DB2 logs through a log analyzer or log
scraping mechanism and feed it to a SQL based database Target, or a Q
replication target or use Web Publishing. Any dates announced?
Thanks,
RdR
|
by: Andrea M. Segovia |
last post by:
Hello,
I am a newbie to Oracle databases....
We have a visualization front-end tool connected to an Oracle back-end
database on a Tru64 UNIX server. We also have clients with MS access
databases who would like to share their data using this visualization
tool but do not want to import their data into the Oracle server
back-end.
| |
by: Ed Rauscher |
last post by:
Does ayone know what Class is used to enable Registry Auditing? Any help
would be great.
|
by: Jonas |
last post by:
Hi!
I'm developing the middletiers of an ASP.NET application in VB.NET. I've got
a business logic layer in which I would like to perform auditing to a
database. Instead of making an auditing call in every method of my classes,
would it be a workable way to implement IDisposable in the base class to all
the BLL-classes and then in the Dispose method to do the audit call? Do I
then have to make sure that all uses of the BLL-classes end...
|
by: Rico |
last post by:
Hello,
I'm creating an audit table and associated triggers to be able to capture
any updates and deletes from various tables in the database. I know how to
capture the records that have been updated or deleted, but is there any way
that I can cycle through a changed record, look at the old vs new values and
capture only the values that have changed?
To give you a better idea of what I'm trying to do, instead of creating a
copy of the...
|
by: dba |
last post by:
Hi folks, I would just like to share with you SQL CodeSecure, a newly
released database protection and auditing tool from SqlLabs:
SQL CodeSecure provides ultimate protection from unauthorized
creation, modification and deletion of database objects. It provides
flexibility through various protection types and granularity at
different protection levels.
CodeSecure comes with a full-featured auditing tool that keeps track
of all changes...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |