The connection_pool
class is used to manage the connection pooling mechanism. This class provides properties for enabling and configuring pooling.
enabled
Enables connection pooling.
Syntax
enabled = False | True
Remarks
enabled
to True
to enable connection pooling. The default value is False
.max_size
The maximum number of connections allowed in the pool
Syntax
max_size = int
max_size[pool_id: int] = int
Remarks
max_size
is 100
.pool_id
) is specified, the maximum number of connections is set for the default connection pool. If the pool ID is specified, the maximum number of connections is set for the pool with the given ID.min_size
The minimum number of connections maintained in the pool
Syntax
min_size = int
min_size[pool_id: int] = int
Remarks
min_size
is 0
.pool_id
) is specified, the minimum number of connections is set for the default connection pool. If the pool ID is specified, the minimum number of connections is set for the pool with the given ID.lifetime
The maximum time (in milliseconds) during which a database connection will be kept in the connection pool
Syntax
lifetime = int
lifetime[pool_id: int] = int
Remarks
lifetime
is set to 0
(by default), the lifetime of a connection is infinite.pool_id
) is specified, the connection lifetime is set for the default connection pool. If the pool ID is specified, the maximum number of connections is set for the pool with the given ID.validate
Specifies whether to validate a connection when it's returned from the pool.
Syntax
validate[pool_id: int] = False | True
Remarks
validate
is False
, the pool will validate a connection only when it's added to the pool. If the value is True
, the pool will validate a connection when it's added or drawn from the pool. The default value is False
.pool_id
) is specified, the validation rule is set for the default connection pool. If the pool ID is specified, the rule is set for the pool with the given ID.