Identifying an application inside of Oracle

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Wes
Posts: 3
Joined: Thu 18 Nov 2004 19:00
Location: www.datamatters.com

Identifying an application inside of Oracle

Post by Wes » Thu 18 Nov 2004 19:03

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

brekhof
Posts: 22
Joined: Tue 16 Nov 2004 21:59

Post by brekhof » Thu 18 Nov 2004 22:19

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

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Fri 19 Nov 2004 14:59

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'.

Guest

Post by Guest » Sun 21 Nov 2004 11:52

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.

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Mon 22 Nov 2004 10:46

ODAC has no appropriate properties. You must execute SQL statement after establishing a connection, using TOraSession.AfterConnect event for example.

WarpEnterprises
Posts: 1
Joined: Thu 24 Jul 2008 12:58

Post by WarpEnterprises » Thu 24 Jul 2008 13:03

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?

Post Reply