I'm trying to build an app using oracle builder (oracle forms) and i want to know the user name after login, is there any option like sessions in (PHP/ JEE) to know who logged in my app?
To get User's Login&App Names
, you may prefer setting them in Forms' ON-LOGON
trigger with Dbms_Application_Info
package's methods using this code :
Declare
v_db_name varchar2(35) := 'mydb1';
v_lg_name varchar2(350):= 'some DesiRed Value'; -- such as a username credential when the current user is being logged on to the DB OR SYS_CONTEXT('USERENV', 'IP_ADDRESS') provided static IP values are assigned per each user.
v_app_name varchar2(350):= :SYSTEM.CURRENT_FORM;
Begin
Logon(:Parameter.Un,:Parameter.Pwd||'@'||v_db_name); -- Un & Pwd are defined in Parameters node of Forms
Dbms_Application_Info.Set_Client_Info( v_lg_name );
Dbms_Application_Info.Set_Module( v_app_name, null );
End;
Whenever you need who logged your application, may issue this sql to see the related session information (provided your current session has select
privilege to query gv$session
dictionary view):
select s.*
from gv$session s
where lower(s.client_info) like lower('%'||'&cli_info'||'%')
and s.module = 'myApp'
order by floor(s.last_call_et / 60), s.username, s.logon_time desc