@@ -1544,9 +1544,9 @@ servers in :ref:`DRCP <drcp>` or Oracle Connection Manager in Traffic Director
15441544Mode's (CMAN-TDM) `Proxy Resident Connection Pooling (PRCP)
15451545<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-E0032017-03B1-
154615464F14-AF9B-BCC87C982DA8> `__. Applications do not need to be modified. The
1547- feature can be enabled by altering the application's :ref: ` connection string
1548- <connstr>`. Applications do not need to explicitly acquire, or release,
1549- connections to be able use a DRCP or PRCP pool.
1547+ feature is enabled by adding a `` pool_boundary `` parameter to the application's
1548+ :ref: ` connection string <connstr >`. Applications do not need to explicitly
1549+ acquire, or release, connections to be able use a DRCP or PRCP pool.
15501550
15511551Implicit connection pooling is available in python-oracledb Thin and
15521552:ref: `Thick <enablingthick >` modes. It requires Oracle Database
@@ -1558,10 +1558,9 @@ DRCP or PRCP pool when they are actually used by the application to do database
15581558work. They are internally released back to pool when not in use. This may
15591559occur between the application's explicit :meth: `oracledb.connect() ` call and
15601560:meth: `Connection.close() ` (or the application's equivalent connection release
1561- at end-of-scope).
1562-
1563- The internal connection release can be controlled by setting a value in the
1564- ``pool_boundary `` parameter. The value can be either:
1561+ at end-of-scope). The internal connection release can be controlled by the
1562+ value of the ``pool_boundary `` connection string parameter, which can be
1563+ either:
15651564
15661565- *statement *: If this boundary is specified, then the connection is released
15671566 back to the DRCP or PRCP connection pool when the connection is implicitly
@@ -1582,8 +1581,20 @@ The internal connection release can be controlled by setting a value in the
15821581 - Run queries that fetch :ref: `LOB <lobdata >` and :ref: `JSON <jsondatatype >`
15831582 data
15841583
1584+ Inline with DRCP and PRCP best practices regarding session sharing across
1585+ differing applications, you should add a connection string
1586+ ``pool_connection_class `` parameter, using the same value for all applications
1587+ that are alike.
1588+
1589+ The DRCP and PRCP "purity" used by Implicit Connection Pooling defaults to
1590+ SELF, which allows reuse of the server process session memory for best
1591+ performance. Adding the connection string parameter ``pool_purity=new `` will
1592+ change this and cause each use of a connection to recreate the session memory.
1593+
15851594.. _useimplicitconnpool :
15861595
1596+ **Configuring Implicit Connection Pooling **
1597+
15871598To use implicit connection pooling in python-oracledb with DRCP:
15881599
158916001. Enable DRCP in the database. For example in SQL*Plus::
@@ -1598,8 +1609,10 @@ To use implicit connection pooling in python-oracledb with DRCP:
15981609
15991610 .. code-block :: python
16001611
1612+ cs = " dbhost.example.com/orclpdb:pooled"
1613+
16011614 pool = oracledb.create_pool(user = " hr" , password = userpwd,
1602- dsn = " dbhost.example.com/orclpdb:pooled " ,
1615+ dsn = cs ,
16031616 min = 2 , max = 5 , increment = 1 ,
16041617 cclass = " MYAPP" )
16051618
@@ -1641,24 +1654,39 @@ To use implicit connection pooling in python-oracledb with DRCP:
16411654 - Or the ``pool_boundary `` parameter in :meth: `oracledb.connect() ` or
16421655 :meth: `oracledb.create_pool() `
16431656
1644- .. note ::
1657+ .. note ::
1658+
1659+ Implicit connection pooling is not enabled if the application sets the
1660+ ``pool_boundary `` attribute to *transaction * or *statement * but does
1661+ not specify to use a pooled server.
1662+
1663+ 4. Set the connection class in:
1664+
1665+ - The :ref: `Easy Connect string <easyconnect >`. For example, to use a class
1666+ name 'myapp'::
1667+
1668+ dsn = "localhost:1521/orclpdb:pooled?pool_boundary=statement&pool_connection_class=myapp"
16451669
1646- - Implicit connection pooling is disabled if the application sets the
1647- ``pool_boundary `` attribute to *transaction * or *statement * but
1648- does not specify to use a pooled server.
1670+ - Or the ``CONNECT_DATA `` section of the :ref: `Connect Descriptor string
1671+ <netservice>`. For example, to use a class name 'myapp'::
16491672
1650- - For all the ``POOL_BOUNDARY `` options, the default purity is set to
1651- *SELF *. You can specify the purity using the ``POOL_PURITY `` parameter
1652- in the connection string to override the default purity value.
1673+ tnsalias = (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mymachine.example.com)
1674+ (PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)
1675+ (SERVER=POOLED)(POOL_BOUNDARY=TRANSACTION)
1676+ (POOL_CONNECTION_CLASS=myapp)))
1677+
1678+ Use the same connection class name for application processes of the same
1679+ type where you want session memory to be reused for connections.
1680+
1681+ The pool purity can also optionally be changed by adding ``POOL_PURITY=NEW ``
1682+ to the connection string or descriptor.
16531683
16541684Similar steps can be used with PRCP. For general information on PRCP, see the
16551685technical brief `CMAN-TDM — An Oracle Database connection proxy for scalable
16561686and highly available applications <https://download.oracle.com/
16571687ocomdocs/global/CMAN_TDM_Oracle_DB_Connection_Proxy_for_scalable_apps.pdf> `__.
16581688
1659- It is recommended to use python-oracledb's local :ref: `connpooling ` where
1660- possible instead of implicit connection pooling. This gives multi-user
1661- applications more control over pooled server reuse.
1689+ **Implicit Pooling Notes **
16621690
16631691You should thoroughly test your application when using implicit connection
16641692pooling to ensure that the internal reuse of database servers does not cause
@@ -1670,6 +1698,9 @@ application connection because different servers may be used at different
16701698times. Another example is when using a statement boundary of *transaction *. In
16711699this scenario, any commit can invalidate open cursors.
16721700
1701+ It is recommended to use python-oracledb's local :ref: `connpooling ` where
1702+ possible instead of implicit connection pooling. This gives multi-user
1703+ applications more control over pooled server reuse.
16731704
16741705.. _proxyauth :
16751706
0 commit comments