@@ -208,23 +208,34 @@ Module Interface
208
208
edition=None, timeout=0, waitTimeout=0, maxLifetimeSession=0, \
209
209
sessionCallback=None, maxSessionsPerShard=0)
210
210
211
- Create and return a :ref: `session pool object <sesspool >`.
211
+ Create and return a :ref: `session pool object <sesspool >`. Session pooling
212
+ (also known as connection pooling) creates a pool of available connections
213
+ to the database, allowing applications to acquire a connection very quickly.
214
+ It is of primary use in a server where connections are requested in rapid
215
+ succession and used for a short period of time, for example in a web server.
216
+ See :ref: `connpool ` for more information.
217
+
212
218
Connection pooling in cx_Oracle is handled by Oracle's
213
219
`Session pooling <https://www.oracle.com/pls/topic/lookup?
214
220
ctx=dblatest&id=GUID-F9662FFB-EAEF-495C-96FC-49C6D1D9625C> `__
215
221
technology. This allows cx_Oracle applications to support features
216
222
like `Application Continuity <https://www.oracle.com/pls/topic/lookup?
217
223
ctx=dblatest&id=GUID-A8DD9422-2F82-42A9-9555-134296416E8F> `__.
218
224
219
- See :ref: `connpool ` for information on connection pooling.
225
+ The user, password and dsn parameters are the same as for
226
+ :meth: `cx_Oracle.connect() `
220
227
221
- Session pooling creates a pool of available connections to the
222
- database, allowing applications to acquire a connection very quickly.
223
- It is of primary use in a server where connections are requested
224
- in rapid succession and used for a short period of time, for example in a
225
- web server.
228
+ The min, max and increment parameters control pool growth behavior. A fixed
229
+ pool size where min equals max is recommended to help prevent connection
230
+ storms and to help overall system stability. The min parameter is the
231
+ number of connections opened when the pool is created. The increment is the
232
+ number of connections that are opened whenever a connection request exceeds
233
+ the number of currently open connections. The max parameter is the maximum
234
+ number of connections that can be open in the connection pool. Note that
235
+ when :ref: `external authentication <extauth >` or :ref: `heterogeneous pools
236
+ <connpooltypes>` are used, the pool growth behavior is different.
226
237
227
- If the connection type is specified, all calls to
238
+ If the connectiontype parameter is specified, all calls to
228
239
:meth: `~SessionPool.acquire() ` will create connection objects of that type,
229
240
rather than the base type defined at the module level.
230
241
@@ -233,6 +244,10 @@ Module Interface
233
244
Doing so in single threaded applications imposes a performance penalty of
234
245
about 10-15% which is why the default is False.
235
246
247
+ The getmode parameter indicates whether or not future
248
+ :func: `SessionPool.acquire() ` calls will wait for available connections. It
249
+ can be one of the :ref: `Session Pool Get Modes <sesspoolmodes >` values.
250
+
236
251
The events parameter is expected to be a boolean expression which indicates
237
252
whether or not to initialize Oracle in events mode. This is required for
238
253
continuous query notification and high availability event notifications.
@@ -241,22 +256,26 @@ Module Interface
241
256
indicates whether or not to create a homogeneous pool. A homogeneous pool
242
257
requires that all connections in the pool use the same credentials. As such
243
258
proxy authentication and external authentication is not possible with a
244
- homogeneous pool.
259
+ homogeneous pool. See :ref: `Heterogeneous and Homogeneous Connection Pools
260
+ <connpooltypes>`.
245
261
246
262
The externalauth parameter is expected to be a boolean expression which
247
263
indicates whether or not external authentication should be used. External
248
264
authentication implies that something other than the database is
249
265
authenticating the user to the database. This includes the use of operating
250
- system authentication and Oracle wallets.
266
+ system authentication and Oracle wallets. See :ref: `Connecting Using
267
+ External Authentication <extauth>`.
251
268
252
- See the :ref: `globalization <globalization >` section for details on the
253
- encoding and nencoding parameters. Note the default encoding and nencoding
254
- values changed to "UTF-8" in cx_Oracle 8, and any character set in NLS_LANG
255
- is ignored.
269
+ The encoding and nencoding parameters set the encodings used for string
270
+ values transferred between cx_Oracle and Oracle Database, see
271
+ :ref: `Character Sets and Globalization <globalization >`. Note the default
272
+ encoding and nencoding values changed to "UTF-8" in cx_Oracle 8, and any
273
+ character set in NLS_LANG is ignored.
256
274
257
- The edition parameter is expected to be a string, if specified, and sets
258
- the edition to use for the sessions in the pool. It is only relevant if
259
- both the client and the server are at least Oracle Database 11.2.
275
+ The edition parameter is expected to be a string, if specified, and sets the
276
+ edition to use for the sessions in the pool. It is only relevant if both the
277
+ client and the server are at least Oracle Database 11.2. See
278
+ :ref: `Edition-Based Redefinition (EBR) <ebr >`.
260
279
261
280
The timeout parameter is expected to be an integer, if specified, and sets
262
281
the length of time (in seconds) after which idle sessions in the pool are
@@ -279,17 +298,18 @@ Module Interface
279
298
may exist.
280
299
281
300
The sessionCallback parameter is expected to be either a string or a
282
- callable. If the parameter is a string, this refers to a PL/SQL procedure
283
- that will be called when :func: `SessionPool.acquire() ` requests a tag and
284
- that tag does not match the connection's actual tag. Support for the PL/SQL
285
- procedure requires Oracle Client libraries 12.2 or later. See the
286
- `OCI documentation <https://www.oracle.com/pls/topic/lookup?
287
- ctx=dblatest&id=GUID-B853A020-752F-494A-8D88-D0396EF57177> `__ for more
288
- information. If the sessionCallback parameter is a callable, however, it
289
- will be called when a newly created connection is returned from the pool
290
- or when a tag is requested and that tag does not match the connection's
291
- actual tag. The callable will be invoked with the connection and the
292
- requested tag as its only parameters.
301
+ callable. If the sessionCallback parameter is a callable, it will be called
302
+ when a newly created connection is returned from the pool, or when a tag is
303
+ requested and that tag does not match the connection's actual tag. The
304
+ callable will be invoked with the connection and the requested tag as its
305
+ only parameters. If the parameter is a string, it should be the name of a
306
+ PL/SQL procedure that will be called when :func: `SessionPool.acquire() `
307
+ requests a tag and that tag does not match the connection's actual tag. See
308
+ :ref: `Session CallBacks for Setting Pooled Connection State
309
+ <sessioncallback>`. Support for the PL/SQL procedure requires Oracle Client
310
+ libraries 12.2 or later. See the `OCI documentation
311
+ <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&
312
+ id=GUID-B853A020-752F-494A-8D88-D0396EF57177> `__ for more information.
293
313
294
314
The maxSessionsPerShard parameter is expected to be an integer, if
295
315
specified, and sets the maximum number of sessions in the pool that can be
@@ -823,6 +843,7 @@ also used by the :attr:`MessageTable.operation` or
823
843
This constant is used to specify that messages should be sent when data is
824
844
updated, or that the message identifies a row that has been updated.
825
845
846
+ .. _sesspoolmodes :
826
847
827
848
Session Pool Get Modes
828
849
----------------------
0 commit comments