1 Reply Latest reply on Oct 19, 2009 12:02 AM by 604934

    How to use Connection.clientinfo with v$session table

      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:

      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
          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")
          select s.PROGRAM, s.CLIENT_INFO, module, action from v$session s where username = 'PLAYER' and program = 'python.exe';

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