如何在审计触发器中使用system_user但仍使用连接池?

发布于 2024-07-05 02:49:03 字数 223 浏览 9 评论 0原文

我想做以下两件事:

  1. 在我的数据库表上使用审计触发器来识别哪个用户更新了什么;
  2. 使用连接池来提高性能

对于#1,我在数据库触发器中使用“system_user”来识别进行更改的用户,但这阻止我执行需要通用连接字符串的#2。

有没有一种方法可以让我充分利用这两个世界?

ASP.NET/SQL Server 2005

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半世晨晓 2024-07-12 02:49:03

很不幸的是,不行。 仅从数据库连接识别用户和在用户之间共享数据库连接是互斥的。

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

蓝眼泪 2024-07-12 02:49:03

将 Web 应用程序中的用户存储在数据库中,并让触发器触发存储的数据。 让 Web 应用程序处理将所有日志信息写入数据库可能会更好。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文