Anthony Tuininga 4185d96682 Adjusted samples to be clearer and to match the tables used in the test suite;
added new samples for DRCP and input/output type handlers.
2017-01-13 10:47:20 -07:00

31 lines
1.1 KiB
Python

#------------------------------------------------------------------------------
# DRCP.py
# This script demonstrates the use of Database Resident Connection Pooling
# (DRCP) which provides a connection pool in the database server, thereby
# reducing the cost of creating and tearing down client connections. The pool
# can be started and stopped in the database by issuing the following commands
# in SQL*Plus:
#
# exec dbms_connection_pool.start_pool()
# exec dbms_connection_pool.stop_pool()
#
# Statistics regarding the pool can be acquired from the following query:
#
# select * from v$pool_cc_stats;
#
# There is no difference in how a connection is used once it has been
# established.
#------------------------------------------------------------------------------
from __future__ import print_function
import cx_Oracle
conn = cx_Oracle.Connection("cx_Oracle/dev@localhost/orcl:pooled",
cclass = "PYCLASS", purity = cx_Oracle.ATTR_PURITY_SELF)
cursor = conn.cursor()
print("Performing query using DRCP...")
for row in cursor.execute("select * from TestNumbers order by IntCol"):
print(row)