we're using Oracle Proxy authentication inside our current middle tier (C++).
As we develop in parallel our Java software, we started to implement same technique in Java.
1) When using connection pool, before returning the connection to the application, we need to 'impersonate' it with the real user.
the code snippet goes like this:
connection pool is initialized with PROXY_MASTER user and PROXY_MASTER password
(a) // cast into an OracleConnection
OracleConnection oraConnection = (OracleConnection) connection;
// close any proxy sessions that would still exist on the connection
if (oraConnection.isProxySession ())
// create a property map with the end user credentials
Properties proxyProps = new Properties ();
proxyProps.put (OracleConnection.PROXY_USER_NAME, <put user-id here>);
// open the proxy session
oraConnection.openProxySession (OracleConnection.PROXYTYPE_USER_NAME, proxyProps);
(b) Once we impersonated the session, we initialize the session on the application level (e.g. set database sorting, language settings, etc.)
2) impersonation is not a very fast thing.. Hence, in our C++ code, we have our own pool mechanism, which first looks for the connection impersonated for the same user. And by this, we save (a) and (b) steps. How can I add hooks to the connection pool so I can filter out connections? If none connection from the requested user exists, the default behavior would be used