Use of pool may be enabled in “classic” connection methods using `pool` property set to true, like:
std::unique_ptr<Connection> conn(DriverManager::getConnection("jdbc:mariadb://localhost:3306/db?user=root&password=someSecretWord&pool=true");
The “new” way is to use DataSource class. MariaDbDataSource class is exposed in the public API:
ds("jdbc:mariadb://localhost:3306/db”);
std::unique_ptr<Connection> conn(ds.getConnection("root", "someSecretWord"));
In this case the pool will be automatically created. In the JDBC, a pool is created if getPooledConnection() is used. These methods are not supported yet, and the pool is created on MariaDbDataSource::getConnection call.
Another extension to JDBC - the pool can be closed with ds.close()
Other connection properties to control the pool:
- minPoolSize - the minimum number of connections always kept in the pool(maxPoolSize value)
- maxPoolSize - The maximum number of physical connections that the pool
can contain(default 8)
- maxIdleTime - The maximum amount of time in seconds that a connection can
stay in the pool if not used. This value must always be below
@wait_timeout value - 45s. Default: 600 in seconds
(=10 minutes), minimum value is 60 seconds
- poolValidMinDelay - The period of time after putting of the connection to the pool, during
which the connection is considered to be good and not validated on return to
the application.
0 means validation is done each time the connection is requested
(default 1000)
Can't that really be added in the next version? i.e. not in the 1st beta