From e692db988b0b4de2ed673ac21621c24702647114 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov min_connections
argument
specifies the minimum number of available connections that
- should be kept open.
ping
argument specifies
+ whether the factory should validate the connection before
+ returning it to the caller.
Whenever a connection is requested, the pool factory first checks if there is an unused connection that can be returned. @@ -6591,12 +6594,20 @@ namespace odb the pool will never close a connection and instead maintain all the connections that were ever created.
+Connection validation (the ping
argument) is useful
+ if your application may experience long periods of inactivity. In
+ such cases the MySQL server may close network connections that have
+ been inactive for too long. If during connection validation the pool
+ factory detects that the connection has been terminated, it silently
+ closes it and tries to find or create another connection instead.
If you pass NULL
as the connection factory to
one of the database
constructors, then the
connection_pool_factory
instance will be
created by default with the min and max connections values
- set to 0. The following code fragment shows how we can
- pass our own connection factory instance:
0
and connection validation enabled.
+ The following code fragment shows how we can pass our own
+ connection factory instance:
#include <odb/database.hxx> -- cgit v1.1