Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Altering the osuser in v$session

Re: Altering the osuser in v$session

From: Steve Howard <stevedhoward_at_gmail.com>
Date: 8 Mar 2007 05:16:41 -0800
Message-ID: <1173359801.612452.34590@8g2000cwh.googlegroups.com>


On Mar 8, 2:10 am, Thomas Kellerer <TAAXADSCB..._at_spammotel.com> wrote:
> On 07.03.2007 11:56 bove027 wrote:
>
> > Hi,
>
> > is it possible to change the osuser of the session?
>
> Depends on how you connect to the database.
> With Java/JDBC this is possible.
>
> Thomas

Hi Thomas,

I would be interested to see how you got that to work. I tried sometime ago, but could never get osuser to set.

C:\java>javac setOsUser.java

C:\java>type setOsUser.java
import java.util.*;
import java.sql.*;
import oracle.jdbc.driver.*;

public class setOsUser {
  public static void main(String args[]) {     try {

          Class.forName("oracle.jdbc.driver.OracleDriver");
          Properties props = new Properties();
      props.put("user", args[0]);
      props.put("password", args[1]);
      props.put("v$session.osuser", "linus");
      props.put("v$session.program", "charlie_brown");
      Connection con =

DriverManager.getConnection("jdbc:oracle:thin:@peantus:152 1:test",props);

      ResultSet rst = con.createStatement().executeQuery("select osuser,program
" +

                                                           "from v
$session " +
                                                           "where sid
= sys_cont
ext('userenv','sid')");
      while (rst.next()) {
                  System.out.println(rst.getString(1) + " " +
rst.getString(2));
          }
      con.close();

    }
    catch (Exception exc) {
      System.out.println(exc.toString());     }
  }
}
C:\java>java setOsUser ***** *****
null charlie_brown

C:\java>

Thanks,

Steve Received on Thu Mar 08 2007 - 07:16:41 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US