Discussions
Categories
- 196.7K All Categories
- 2.2K Data
- 235 Big Data Appliance
- 1.9K Data Science
- 449.8K Databases
- 221.5K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 549 MySQL Community Space
- 477 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 532 SQLcl
- 4K SQL Developer Data Modeler
- 186.8K SQL & PL/SQL
- 21.2K SQL Developer
- 295.4K Development
- 17 Developer Projects
- 138 Programming Languages
- 292K Development Tools
- 104 DevOps
- 3.1K QA/Testing
- 645.9K Java
- 27 Java Learning Subscription
- 37K Database Connectivity
- 153 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 17 Java Essentials
- 158 Java 8 Questions
- 85.9K Java Programming
- 79 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.2K Java SE
- 13.8K Java Security
- 203 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 390 LiveLabs
- 37 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.6K Other Languages
- 2.3K Chinese
- 170 Deutsche Oracle Community
- 1K Español
- 1.9K Japanese
- 230 Portuguese
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:
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...
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...
Answers
-
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 win32select s.PROGRAM, s.CLIENT_INFO, module, action from v$session s where username = 'PLAYER' and program = 'python.exe';import cx_Oracle
con = cx_Oracle.connect("player/[email protected]")
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()
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
This discussion has been closed.