@@ -32,32 +32,28 @@ Oracle Client and Oracle Database communicate.
3232There are two ways to create a connection to Oracle Database using
3333python-oracledb:
3434
35- * **Standalone connections **: :ref: `Standalone connections <standaloneconnection >`
36- are useful when the application needs a single connection to a database.
37- Connections are created by calling :meth: `oracledb.connect() `.
38-
39- * **Pooled connections **: :ref: `Connection pooling <connpooling >` is important for
40- performance when applications frequently connect and disconnect from the database.
41- Pools support Oracle's :ref: `high availability <highavailability >` features and are
42- recommended for applications that must be reliable. Small pools can also be
43- useful for applications that want a few connections available for infrequent
44- use. Pools are created with :meth: `oracledb.create_pool() ` at application
45- initialization time, and then :meth: `ConnectionPool.acquire() ` can be called to
46- obtain a connection from a pool.
35+ * **Standalone connections **: :ref: `Standalone connections
36+ <standaloneconnection>` are useful when the application needs a single
37+ connection to a database. Connections are created by calling
38+ :meth: `oracledb.connect() `. For :ref: `asyncio <asyncio >`, use
39+ :meth: `oracledb.connect_async() ` instead, see :ref: `connasync `.
40+
41+ * **Pooled connections **: :ref: `Connection pooling <connpooling >` is important
42+ for performance when applications frequently connect and disconnect from the
43+ database. Pools support Oracle's :ref: `high availability <highavailability >`
44+ features and are recommended for applications that must be reliable. Small
45+ pools can also be useful for applications that want a few connections
46+ available for infrequent use. Pools are created with
47+ :meth: `oracledb.create_pool() ` at application initialization time, and then
48+ :meth: `ConnectionPool.acquire() ` can be called to obtain a connection from a
49+ pool. For :ref: `asyncio <asyncio >`, use :meth: `oracledb.create_pool_async() `
50+ and :meth: `AsyncConnectionPool.acquire() ` instead, see :ref: `asyncconnpool `.
4751
4852Many connection behaviors can be controlled by python-oracledb connection
4953options. Other settings can be configured in :ref: `optnetfiles ` or in
5054:ref: `optclientfiles `. These include limiting the amount of time that opening
5155a connection can take, or enabling :ref: `network encryption <netencrypt >`.
5256
53- .. note ::
54-
55- Creating a connection in python-oracledb Thin mode always requires a
56- connection string, or the database host name and service name, to be
57- specified. The Thin mode cannot use "bequeath" connections and does not
58- reference Oracle environment variables ``ORACLE_SID ``, ``TWO_TASK ``,
59- or ``LOCAL ``.
60-
6157.. _standaloneconnection :
6258
6359Standalone Connections
@@ -287,6 +283,14 @@ For more information about naming methods, see the `Database Net Services
287283Administrator's Guide
288284<https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-E5358DEA-D619-4B7B-A799-3D2F802500F1> `__.
289285
286+ .. note ::
287+
288+ Creating a connection in python-oracledb Thin mode always requires a
289+ connection string, or the database host name and service name, to be
290+ specified. The Thin mode cannot use "bequeath" connections and does not
291+ reference Oracle environment variables ``ORACLE_SID ``, ``TWO_TASK ``,
292+ or ``LOCAL ``.
293+
290294.. _easyconnect :
291295
292296Easy Connect Syntax for Connection Strings
@@ -1883,6 +1887,10 @@ creation calls. If you call :meth:`ConnectParams.parse_connect_string()`, the
18831887registered protocol hook method will be called but the parameter hook will not
18841888be.
18851889
1890+ ..
1891+ Note to doc writers: do not change the following heading because it is used
1892+ for a link emitted by ldap_hook() in src/oracledb/builtin_hooks.py
1893+
18861894.. _ldapconnections :
18871895
18881896LDAP Directory Naming
@@ -2061,8 +2069,17 @@ Connection Pooling
20612069==================
20622070
20632071Connection pooling can significantly improve application performance and
2064- scalability, allows resource sharing, and lets applications use advanced Oracle
2065- High Availability features.
2072+ scalability by allowing resource sharing. Pools also let applications use
2073+ optional advanced Oracle High Availability features.
2074+
2075+ Opening a connection to a database can be expensive: the connection string must
2076+ be parsed, a network connection must be established, the Oracle Database
2077+ network listener needs to be invoked, user authentication must be performed, a
2078+ database server process must be created, and session memory must be allocated
2079+ (and then the process is destroyed when the connection is closed). Connection
2080+ pools remove the overhead of repeatedly opening and closing :ref: `standalone
2081+ connections <standaloneconnection>` by establishing a pool of open connections
2082+ that can be reused throughout the life of an application process.
20662083
20672084The pooling solutions available to python-oracledb applications are:
20682085
@@ -2092,12 +2109,12 @@ The pooling solutions available to python-oracledb applications are:
20922109
20932110- `Proxy Resident Connection Pooling (PRCP)
20942111 <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-E0032017-03B1-
2095- 4F14-AF9B-BCC87C982DA8> `__: This is connection pooling handled by a dedicated
2096- mid-tier connection proxy, `CMAN-TDM <https://download.oracle.com/
2097- ocomdocs/global/CMAN_TDM_Oracle_DB_Connection_Proxy_for_scalable_
2098- apps .pdf> `__.
2112+ 4F14-AF9B-BCC87C982DA8> `__: This is connection pooling handled by Oracle's
2113+ mid-tier connection proxy solution , `CMAN-TDM <https://download.oracle.com/
2114+ ocomdocs/global/
2115+ CMAN_TDM_Oracle_DB_Connection_Proxy_for_scalable_apps .pdf> `__.
20992116
2100- This is useful for applications taking advantage of CMAN-TDM.
2117+ PRCP is useful for applications taking advantage of CMAN-TDM.
21012118
21022119- :ref: `implicitconnpool `: This can add pooling benefits to applications that
21032120 connect when they start, and only close the connection when the application
@@ -2242,6 +2259,11 @@ server process to be released, use :meth:`ConnectionPool.drop()`:
22422259
22432260 pool.drop(connection)
22442261
2262+ Avoid doing this unnecessarily because it shrinks the pool. A future
2263+ :meth: `~ConnectionPool.acquire() ` call may suffer the overhead of establishing
2264+ a new connection to the database, instead of being able to reuse a connection
2265+ already available in the pool.
2266+
22452267Closing a Connection Pool
22462268+++++++++++++++++++++++++
22472269
0 commit comments