Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unexpected Behavior when Using Proxy Sessions

lucborsJun 10 2014 — edited Jun 12 2014

Hi all,

I'm having an issue using PROXYTYPE connections in my ADF (11.1.1.7) Application.

To explain the problem, I created two functional users that have "connect" privileges "through" the user that sets up the jdbc connection.

Grant connect through MY_JDBC_USER to MY_FUNC_USER_ONE;

Grant connect through MY_JDBC_USER to MY_FUNC_USER_TWO with roles ROLE_ONE;

If I connect MY_FUNC_USER_ONE, the connection is successful. The current user (line 09 below) is displayed as FUNC_USER_ONE. Unfortunately I get lots of ORA_0942 (table or view does not exist).

That is why I added the "with roles" option to MY_FUNC_USER_TWO.

However when I now try to connect MY_FUNC_USER_TWO using the openProxySession(), it does not work... The current user (line 09 below) is displayed as MY_JDBC_USER.

I do not get any errors from the database, so to be honest I don't have a clue why this is not working.....

Here is my code and note that I created my ownTranscationFactory that extends DatabaseTransactionFactory .

public void prepareSession (Session session){

myTransactionImpl myTrans = (myTransactionImpl)this.getDBTransaction();
        OracleConnection conn = hzpcTrans.getConnection();
        String currentUser = ADFContext.getCurrent().getSecurityContext().getUserName();
        java.util.Properties prop = new java.util.Properties();
        prop.put(OracleConnection.PROXY_USER_NAME, currentUser);

      try {
            conn.openProxySession(OracleConnection.PROXYTYPE_USER_NAME, prop);
            DatabaseMetaData meta = conn.getMetaData();           
            System.out.println("the user currently on the session is " + meta.getUserName());
        }

.catch.........

}

Any help is welcome.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 10 2014
Added on Jun 10 2014
3 comments
1,471 views