Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Altering the osuser in v$session
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 =
ResultSet rst = con.createStatement().executeQuery("select
osuser,program
" +
"from v $session " + "where sid= sys_cont
while (rst.next()) { System.out.println(rst.getString(1) + " " +rst.getString(2));
} con.close();
C:\java>
Thanks,
Steve Received on Thu Mar 08 2007 - 07:16:41 CST
![]() |
![]() |