Page 1 of 1
Identifying an application inside of Oracle
Posted: Thu 18 Nov 2004 19:03
by Wes
Hi,
I am wondering how to identify my application in Oracle's v$session. The specific columns are program and module; I would like to know how to populate either one. I can do it programmatically but I was wondering if there was an automatic method. I am looking at it this way so that I can use a database logon trigger to capture context.
thx,
wes
Posted: Thu 18 Nov 2004 22:19
by brekhof
Not sure what you mean, v$_session should automatically show the name of your program (in program). there was a ODAC 3.x version that left it emty but that problem has been solved some time back.
hth,
Martin
Posted: Fri 19 Nov 2004 14:59
by Paul
The PROGRAM column fills automatically by OCI.
You cannot set the MODULE column automatically, but you can use the DBMS_APPLICATION_INFO.SET_MODULE.
This procedure sets the name of the module.
Syntax:
DBMS_APPLICATION_INFO.SET_MODULE (module_name IN VARCHAR2,action_name IN VARCHAR2);
Parameters:
module_name : Name of the module. Names longer than 48 bytes are truncated.
action_name : Name of the action within the current module. If you do not want to specify an action, this value should be NULL. Names longer than 32 bytes are truncated.
For additional information see Oracle documentation 'Supplied PL/SQL Packages and Types Reference'.
Posted: Sun 21 Nov 2004 11:52
by Guest
I don't want to set it in Oracle as you have shown. I want to set it in Delphi itself, so that the name of the program is known during the logon rather than right after it.
Posted: Mon 22 Nov 2004 10:46
by Paul
ODAC has no appropriate properties. You must execute SQL statement after establishing a connection, using TOraSession.AfterConnect event for example.
Posted: Thu 24 Jul 2008 13:03
by WarpEnterprises
Using DBMS_APPLICATION_INFO works a while, but (due to session pooling?) there is more than one session in the database, although there is only one connection at a time used in the client. Those other sessions don't have "module" set and after some time the session which was "treated" is gone.
Is there a way around this?