Announcement Announcement Module
Collapse
No announcement yet.
[Oracle proxy user] Why user's server type is DEDICATED instead of PSEUDO? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Oracle proxy user] Why user's server type is DEDICATED instead of PSEUDO?

    Hi,

    Have anyone successfully apply Oracle proxy user using any approaches? I've tried to customize OpenSessionInViewFilter and it works but the user session's server type is DEDICATED instead of PSEUDO, therefore, the exception "ORA-00942: table or view does not exist". Does anyone know why?

    Here's the code:

    public class ProxyUserFilter extends OpenSessionInViewFilter {
    private static Log logger = LogFactory.getLog(ProxyUserFilter.class);

    // TODO: Handle concurrency?
    private String userName;

    protected SessionFactory lookupSessionFactory(HttpServletRequest httpServletRequest) {
    userName = httpServletRequest.getUserPrincipal().getName();
    return super.lookupSessionFactory(httpServletRequest);
    }

    protected Session getSession(SessionFactory sessionFactory)
    throws DataAccessResourceFailureException {
    Session session = super.getSession(sessionFactory);
    try {
    Connection conn = session.connection().getMetaData().getConnection() ;
    if (!(conn instanceof OracleConnection)) {
    throw new RuntimeException("This filter implementation supports Oracle.");
    }
    OracleConnection oraConn = (OracleConnection)conn;
    if (!oraConn.isProxySession()) {
    Properties properties = new Properties();
    properties.put(OracleConnection.PROXY_USER_NAME, userName);
    oraConn.openProxySession(OracleConnection.PROXYTYP E_USER_NAME, properties);
    logger.trace(String.format("Set proxy user '%s' successfully.", userName));
    }
    } catch (SQLException e) {
    throw new DataAccessResourceFailureException(e.getMessage(), e);
    }
    return session;
    }
    }
Working...
X