Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a database which is used for a web application(not website).

For each web application user, Is it advisable to create separate db user?

Now I have a single db user to access from the web application. My objective is to have an audit trail for any update or delete. If I am using AFTER DELETE Trigger, I am not able to identify the exact user who is deleting the record.

Please advise me the right way to go ahead.

Thank you in advance.
Posted

No. If you want to track use, require a login and store the user id for actions they do.
 
Share this answer
 
Comments
[no name] 22-Dec-13 6:47am    
But how e.g. triggers can then be f(user)? A beginners question ;)
Christian Graus 22-Dec-13 16:42pm    
You write triggers and use them. They are an unrelated question, and your best bet is to read an online article with examples, not rely on a forum post ( I will write an article on triggers in time, but I have not yet ).
Murugan Kolanji 23-Dec-13 1:51am    
right now, we are using trigger only. but we cant get the user details while raise delete trigger.
Christian Graus 23-Dec-13 4:12am    
So your real question should be, we have a trigger, here's the code, here's the table definition, and here's what we are having trouble doing ?
There should not be separate DB for Audit trails.

Refer the link added which can give a fair idea on the best practices for creating and maintaining audit trails.

http://www.4guysfromrolla.com/webtech/041807-1.shtml[^]

Hope this helps...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900