Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DRCP with cx_Oracle doesn't appear to work as expected

John PapanastasiouJul 14 2014 — edited Aug 28 2014

I'm trying to use DRCP in Oracle 11.2 with a Python client using cx_Oracle 5.1.2.

If I create the connection by calling cx_Oracle.connect and adding a cclass argument and a purity argument, then the record in sys.v_$cpool_cc_stats with cclass_name set to my cclass will show an increase in num_requests and num_misses corresponding to the number of calls I make, with num_hits staying at 0.

connection = cx_Oracle.connect(user=db['USER'], password=db['PASSWORD'], dsn=db['NAME'], cclass=db['OPTIONS']['CCLASS'], purity=cx_Oracle.ATTR_PURITY_SELF)

If however I create an instance of a cx_Oracle.SessionPool, then pass that instance into the same cx_Oracle.connect call as an extra 'pool' argument, then num_misses goes up by 1, and num_hits goes up by num_requests - 1 (I assume this means the first request is a new connection, all the rest are using that connection).

pool = cx_Oracle.SessionPool(user=db['USER'], password=db['PASSWORD'], dsn=db['NAME'], min=1, max=2, increment=1)

connection = cx_Oracle.connect(user=db['USER'], password=db['PASSWORD'], dsn=db['NAME'], pool=pool, cclass=db['OPTIONS']['CCLASS'], purity=cx_Oracle.ATTR_PURITY_SELF)


Is this correct?  Do I need to be creating a SessionPool client side, then using that to acquire and release connections?

This article doesn't mention SessionPool at all.  I came across SessionPool in this post, but that isn't official documentation.

FWIW, when I run select * from dba_cpool_info, I get the following:

"CONNECTION_POOL""STATUS""MINSIZE""MAXSIZE""INCRSIZE""SESSION_CACHED_CURSORS""INACTIVITY_TIMEOUT""MAX_THINK_TIME""MAX_USE_SESSION""MAX_LIFETIME_SESSION"
"SYS_DEFAULT_CONNECTION_POOL""ACTIVE"44022030012050000086400
This post has been answered by Avinash Nandakumar-Oracle on Aug 1 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 25 2014
Added on Jul 14 2014
7 comments
3,782 views