【发布时间】:2015-01-03 21:10:48
【问题描述】:
在开始我的问题之前,我想澄清一下,我是一名数据库开发人员,对 Java/J2EE 方面的了解有限。
Ours 是一个 Web 应用程序(具有应用服务器/Web 服务器的 n 层)。我们正在使用连接池来管理与数据库的连接。我对连接池的理解有限 - 应用服务器管理应用程序的连接,让应用程序从池中获取连接,一旦连接完成就返回池。
Let's say that I follow these steps -
1. Let's say that I log in the application
2. Application requests for a connection from connection pool to authenticate me
3. Once authentication is done, App server will return the connection back to pool
4. I browse to a page where I have to do some CRUD operation and let's say that I am updating some data on the page.
5. App Server will again request for a connection from Pool
6. Application will process the data using the connection.
这是我的问题陈述 -
假设我必须使用触发器(在正在更新的表上)捕获审计信息。我需要捕获的属性之一是 username (登录用户)。
我在登录时设置了一个全局包变量(步骤 1 - 3),它存储了登录的用户名。我的触发器将读取 username 的全局包变量。由于连接不会保持不变(连接池管理连接),当我处理触发器时,我的全局包变量是否可用?
当多个用户登录并访问应用程序时,变量会发生什么(显然取决于对第一个问题的回答)?
我试图环顾四周,但未能明确回答我的疑问。
如果我的问题不清楚,请原谅我。让我知道,我可以编辑以提供更多信息。
【问题讨论】:
标签: java oracle oracle11g database-connection connection-pooling