Constructor for creating a connection pool.
An AsyncConnectionPool object should be created with oracledb.create_pool_async()
.
Added in version 2.0.0.
Note
AsyncConnectionPool objects are only supported in the python-oracledb Thin mode.
Acquires a connection from the pool and returns an asynchronous connection object.
If the pool is homogeneous, the user
and password
parameters cannot be specified. If they are, an exception will be raised.
The cclass
parameter, if specified, should be a string corresponding to the connection class for Database Resident Connection Pooling (DRCP).
The purity
parameter is expected to be one of PURITY_NEW
, PURITY_SELF
, or PURITY_DEFAULT
.
The tag
, matchanytag
, shardingkey
, and supershardingkey
parameters are ignored in python-oracledb Thin mode.
Closes the pool now, rather than when the last reference to it is released, which makes it unusable for further work.
If any connections have been acquired and not released back to the pool, this method will fail unless the force
parameter is set to True.
Drops the connection from the pool which is useful if the connection is no longer usable (such as when the session is killed).
Releases the connection back to the pool now. The connection will be unusable from this point forward. An Error exception will be raised if any operation is attempted with the connection. Any cursors or LOBs created by the connection will also be marked unusable and an Error exception will be raised if any operation is attempted with them.
The tag
parameter is ignored in python-oracledb Thin mode.
Note
Asynchronous connections are not automatically closed at the end of scope. This is different to synchronous connection behavior. Asynchronous connections should either be explicitly released, or have been initially created via a context manager with
statement.
This read-only attribute returns the number of connections currently acquired.
This read-only attribute returns the TNS entry of the database to which a connection has been established.
This read-write attribute determines how connections are returned from the pool. If POOL_GETMODE_FORCEGET
is specified, a new connection will be returned even if there are no free connections in the pool. POOL_GETMODE_NOWAIT
will raise an exception if there are no free connections are available in the pool. If POOL_GETMODE_WAIT
is specified and there are no free connections in the pool, the caller will wait until a free connection is available. POOL_GETMODE_TIMEDWAIT
uses the value of wait_timeout
to determine how long the caller should wait for a connection to become available before returning an error.
This read-only boolean attribute indicates whether the pool is considered homogeneous or not. If the pool is not homogeneous, different authentication can be used for each connection acquired from the pool.
This read-only attribute returns the number of connections that will be established when additional connections need to be created.
This read-only attribute returns the maximum number of connections that the pool can control.
This read-write attribute is the maximum length of time (in seconds) that a pooled connection may exist since first being created. A value of 0 means there is no limit. Connections become candidates for termination when they are acquired or released back to the pool, and have existed for longer than max_lifetime_session
seconds. Connections that are in active use will not be closed. In python-oracledb Thick mode, Oracle Client libraries 12.1 or later must be used and, prior to Oracle Client 21, cleanup only occurs when the pool is accessed.
This read-write attribute returns the number of sessions that can be created per shard in the pool. Setting this attribute greater than zero specifies the maximum number of sessions in the pool that can be used for any given shard in a sharded database. This lets connections in the pool be balanced across the shards. A value of 0 will not set any maximum number of sessions for each shard. This attribute is only available in Oracle Client 18.3 and higher.
This read-only attribute returns the number of connections with which the connection pool was created and the minimum number of connections that will be controlled by the connection pool.
This read-only attribute returns the name assigned to the pool by Oracle.
This read-only attribute returns the number of connections currently opened by the pool.
This read-write integer attribute specifies the pool ping interval in seconds. When a connection is acquired from the pool, a check is first made to see how long it has been since the connection was put into the pool. If this idle time exceeds ping_interval
, then a round-trip ping to the database is performed. If the connection is unusable, it is discarded and a different connection is selected to be returned by acquire()
. Setting ping_interval
to a negative value disables pinging. Setting it to 0 forces a ping for every acquire()
and is not recommended.
This read-write boolean attribute returns whether the SODA metadata cache is enabled or not. Enabling the cache significantly improves the performance of methods SodaDatabase.createCollection()
(when not specifying a value for the metadata
parameter) and SodaDatabase.openCollection()
. Note that the cache can become out of date if changes to the metadata of cached collections are made externally.
This read-write attribute specifies the size of the statement cache that will be used for connections obtained from the pool. Once a connection is created, that connection’s statement cache size can only be changed by setting the stmtcachesize
attribute on the connection itself.
See Statement Caching for more information.
This read-only attribute returns a boolean which indicates the python-oracledb mode in which the pool was created. If the value of this attribute is True, it indicates that the pool was created in the python-oracledb Thin mode. If the value of this attribute is False, it indicates that the pool was created in the python-oracledb Thick mode.
This read-write attribute specifies the time (in seconds) after which idle connections will be terminated in order to maintain an optimum number of open connections. A value of 0 means that no idle connections are terminated. Note that in python-oracledb Thick mode with older Oracle Client Libraries, the termination only occurs when the pool is accessed.
This read-only attribute returns the name of the user which established the connection to the database.
This read-write attribute specifies the time (in milliseconds) that the caller should wait for a connection to become available in the pool before returning with an error. This value is only used if the getmode
parameter to oracledb.create_pool()
was the value oracledb.POOL_GETMODE_TIMEDWAIT
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4