This discussion is archived
1 Reply Latest reply: Oct 18, 2009 5:02 PM by 604934 RSS

How to use Connection.clientinfo with v$session table

700084 Newbie
Currently Being Moderated
Hi everyone,

I'm trying to keep tabs on the number of connections I create (via python and cx_Oracle) by monitoring Oracle's v$session table.

From the cx_Oracle docs, it appears the preferred way to write my "module" and "action" parameters to v$session is via the Connection.clientinfo method.

I tried creating a connection and using that method, but the results did not appear in the v$session table. Below is how I called the method:

cnx.clientinfo(module="name of module", action="myaction")

Is that the correct way to use "clientinfo"?

The cx_Oracle docs don't provide any usage examples (that I could find), and only point to the Python DB API specs. I didn't notice a mention of this method there:
http://www.python.org/dev/peps/pep-0249/

Can anyway show me an example of how to use the "clientinfo" method? Also, is it necessary to have "write" permission for my username in order to access v$session? If so, perhaps that's my problem...
  • 1. Re: How to use Connection.clientinfo with v$session table
    604934 Oracle ACE Director
    Currently Being Moderated
    C:\Documents and Settings\tchsensoy>python
    Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32
    import cx_Oracle
    con = cx_Oracle.connect("player/player@pground")
    cur = con.cursor()
    con.module="query module"
    con.action="dual query"
    con.clientinfo="Husnu Sensoy"
    # Run below SQL after running this line ....
    cur.execute("select dummy from dual")
    con.close()
    exit()
    select s.PROGRAM, s.CLIENT_INFO, module, action from v$session s where username = 'PLAYER' and program = 'python.exe';

    PROGRAM CLIENT_INFO MODULE ACTION
    ----------------- ---------------------- ----------------------- --------------------------------
    python.exe Husnu Sensoy query module dual query

    Hüsnü ┼×ensoy

    Edited by: HSensoy on 19.Eki.2009 02:58

    Edited by: HSensoy on 19.Eki.2009 02:59

    Edited by: HSensoy on 19.Eki.2009 03:00

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points