Re: Q: Get OS Userid
Date: Tue, 21 Jun 1994 07:48:11 GMT
Message-ID: <ccahdm.60.00478CA1_at_beluga.upe.ac.za>
In article <1994Jun19.162306.24152_at_ericsson.se> ebcrbj_at_ebcw150.ericsson.se (BO/EBC/KX/RGFC Roger Bjaerevall 08-682 4851) writes:
>Is it possible to get the OS userid of the current user (SUN OS)?
>The 'SELECT user FROM dual' call does only return current ORACLE userid.
>I did not find any matching parameter to the USERENV() call either.
>We need this because our application is connecting to only one static
>specified ORACLE userid/password. Though we need to track each specific
>user with the OS userid.
You can use a C program to get the OS user id (perhaps using getuid and
getpwuid with Solaris/System V).
If you need to access it via a single SQL statement then you could write a
C program which stores (usercode,terminal) combinations in a table (you get
the terminal using USERENV('TERMINAL')) which you call in the .profile script.
Then whenever you need the usercode you do a SELECT USERCODE
INTO usercode
FROM USERS
WHERE USER=USERENV('TERMINAL');
Donald Munro (ccahdm_at_beluga.upe.ac.za)
Computing Centre, University of Port Elizabeth
Received on Tue Jun 21 1994 - 09:48:11 CEST