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" | 4 | 40 | 2 | 20 | 300 | 120 | 500000 | 86400 |