How to use system_user in audit trigger but still use connection pooling?

柔情痞子 提交于 2019-12-12 18:44:42

问题


I would like to do both of the following things:

  1. use audit triggers on my database tables to identify which user updated what;
  2. use connection pooling to improve performance

For #1, I use 'system_user' in the database trigger to identify the user making the change, but this prevent me from doing #2 which requires a generic connection string.

Is there a way that I can get the best of both of these worlds?

ASP.NET/SQL Server 2005


回答1:


Unfortunately, no. Identifying the user just from the database connection AND sharing database connections between users are mutually exclusive.




回答2:


Store the user from your web application in the database and let your triggers go off that stored data. It might even be better to let the web app handle writing all logging information to the database.



来源:https://stackoverflow.com/questions/93848/how-to-use-system-user-in-audit-trigger-but-still-use-connection-pooling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!