SHARE
TWEET

Untitled

a guest May 27th, 2018 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
  2.             Class.forName("oracle.jdbc.driver.OracleDriver");
  3.  
  4.             String connectionString = "jdbc:oracle:thin:@gas1n1.miit.ru:1521:ngeneral";
  5.  
  6.             //conn = DriverManager.getConnection (connectionString, "wlwpp_u2_my", "jsh5jjxkyky");
  7.  
  8.             conn = (OracleConnection)DriverManager.getConnection(connectionString); // EXCEPTION
  9.  
  10.  
  11.  
  12.             Properties userNameProp = new Properties();
  13.  
  14.             userNameProp.put(OracleConnection.PROXY_USER_NAME, request.getUserPrincipal().getName());
  15.  
  16.             conn.openProxySession(OracleConnection.PROXYTYPE_USER_NAME, userNameProp);
  17.  
  18.             userenvStmt = conn.
  19.  
  20.                     prepareStatement(" select " +
  21.  
  22.  
  23.                         "sys_context('USERENV','PROXY_USER') " +
  24.  
  25.                         ", sys_context('USERENV','external_name') " +
  26.  
  27.                         ", sys_context('USERENV','SESSION_USER') " +
  28.  
  29.                         ", sys_context('USERENV', 'ENTERPRISE_IDENTITY') " +
  30.  
  31.                         " from dual");
  32.  
  33.             userenvRset = userenvStmt.
  34.  
  35.                     executeQuery();
  36.  
  37.             if (userenvRset.next()) {
  38.  
  39.                 out.println("Userenv proxy_user : " + userenvRset.getString(1) + "");
  40.  
  41.                 out.println("Userenv external_name : " + userenvRset.getString(2) + "");
  42.  
  43.                 out.println("Userenv session_user : " + userenvRset.getString(3) + "");
  44.  
  45.                 out.println("Userenv ENTERPRISE_IDENTITY: " + userenvRset.getString(4) + "");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top