Package org.apache.commons.dbcp2

# Class BasicDataSource

java.lang.Object
org.apache.commons.dbcp2.BasicDataSource

All Implemented Interfaces:
  `AutoCloseable`, `Wrapper`, `MBeanRegistration`, `CommonDataSource`, `DataSource`, `BasicDataSourceMXBean`, `DataSourceMXBean`

Direct Known Subclasses:
  `BasicManagedDataSource`

public class BasicDataSource extends Object implements DataSource, BasicDataSourceMXBean, MBeanRegistration, AutoCloseable
Basic implementation of `javax.sql.DataSource` that is configured via JavaBeans properties.

This is not the only way to combine the commons-dbcp2 and commons-pool2 packages, but provides a one-stop solution for basic requirements.

Since:
  2.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BasicDataSource()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addConnectionProperty(String name, String value)`
  Adds a custom connection property to the set that will be passed to our JDBC driver.
  `void`
  `close()`
  Closes and releases all idle connections that are currently stored in the connection pool associated with this data source.
  `protected ConnectionFactory`
  `createConnectionFactory()`
  Creates a JDBC connection factory for this data source.
  `protected void`
  `createConnectionPool(PoolableConnectionFactory factory)`
  Creates a connection pool for this datasource.
  `protected DataSource`
  `createDataSource()`
  Creates (if necessary) and return the internal data source we are using to manage our connections.
  `protected DataSource`
  `createDataSourceInstance()`
  Creates the actual data source instance.
  `protected GenericObjectPool<PoolableConnection>`
  `createObjectPool(PoolableConnectionFactory factory, GenericObjectPoolConfig<PoolableConnection> poolConfig, AbandonedConfig abandonedConfig)`
  Creates an object pool used to provide pooling support for `JDBC connections`.
  `protected PoolableConnectionFactory`
  `createPoolableConnectionFactory(ConnectionFactory driverConnectionFactory)`
  Creates the PoolableConnectionFactory and attaches it to the connection pool.
  `void`
  `evict()`
  Manually evicts idle connections
  `PrintWriter`
  `getAbandonedLogWriter()`
  Gets the print writer used by this configuration to log information on abandoned objects.
  `boolean`
  `getAbandonedUsageTracking()`
  If the connection pool implements `UsageTracking`, should the connection pool record a stack trace every time a method is called on a pooled connection and retain the most recent stack trace to aid debugging of abandoned connections?
  `boolean`
  `getAutoCommitOnReturn()`
  Gets the value of the flag that controls whether or not connections being returned to the pool will be checked and configured with `Connection.setAutoCommit(true)` if the auto commit setting is `false` when the connection is returned.
  `boolean`
  `getCacheState()`
  Gets the state caching flag.
  `Connection`
  `getConnection()`
  Creates (if necessary) and return a connection to the database.
  `Connection`
  `getConnection(String user, String pass)`
  BasicDataSource does NOT support this method.
  `String`
  `getConnectionFactoryClassName()`
  Gets the ConnectionFactoryClassName that has been configured for use by this pool.
  `List<String>`
  `getConnectionInitSqls()`
  Gets the list of SQL statements executed when a physical connection is first created.
  `String[]`
  `getConnectionInitSqlsAsArray()`
  Provides the same data as `getConnectionInitSqls()` but in an array so it is accessible via JMX.
  `GenericObjectPool<PoolableConnection>`
  `getConnectionPool()`
  Gets the underlying connection pool.
  `Boolean`
  `getDefaultAutoCommit()`
  Gets the default auto-commit property.
  `String`
  `getDefaultCatalog()`
  Gets the default catalog.
  `Integer`
  `getDefaultQueryTimeout()`
  Deprecated.
  Use `getDefaultQueryTimeoutDuration()`.
  `Duration`
  `getDefaultQueryTimeoutDuration()`
  Gets the default query timeout that will be used for `Statement`s created from this connection.
  `Boolean`
  `getDefaultReadOnly()`
  Gets the default readOnly property.
  `String`
  `getDefaultSchema()`
  Gets the default schema.
  `int`
  `getDefaultTransactionIsolation()`
  Gets the default transaction isolation state of returned connections.
  `Set<String>`
  `getDisconnectionIgnoreSqlCodes()`
  Gets the set of SQL State codes that are not considered fatal disconnection codes.
  `String[]`
  `getDisconnectionIgnoreSqlCodesAsArray()`
  Provides the same data as `getDisconnectionIgnoreSqlCodes()` but in an array, so it is accessible via JMX.
  `Set<String>`
  `getDisconnectionSqlCodes()`
  Gets the set of SQL State codes considered to signal fatal conditions.
  `String[]`
  `getDisconnectionSqlCodesAsArray()`
  Provides the same data as `getDisconnectionSqlCodes()` but in an array so it is accessible via JMX.
  `Driver`
  `getDriver()`
  Gets the JDBC Driver that has been configured for use by this pool.
  `ClassLoader`
  `getDriverClassLoader()`
  Gets the class loader specified for loading the JDBC driver.
  `String`
  `getDriverClassName()`
  Gets the JDBC driver class name.
  `Duration`
  `getDurationBetweenEvictionRuns()`
  Gets the value of the {code durationBetweenEvictionRuns} property.
  `boolean`
  `getEnableAutoCommitOnReturn()`
  Deprecated.
  Use `getAutoCommitOnReturn()`.
  `String`
  `getEvictionPolicyClassName()`
  Gets the EvictionPolicy implementation in use with this connection pool.
  `boolean`
  `getFastFailValidation()`
  True means that validation will fail immediately for connections that have previously thrown SQLExceptions with SQL State indicating fatal disconnection errors.
  `int`
  `getInitialSize()`
  Gets the initial size of the connection pool.
  `String`
  `getJmxName()`
  Gets the JMX name that has been requested for this DataSource.
  `boolean`
  `getLifo()`
  Gets the LIFO property.
  `boolean`
  `getLogAbandoned()`
  Flag to log stack traces for application code which abandoned a Statement or Connection.
  `boolean`
  `getLogExpiredConnections()`
  When `getMaxConnDuration()` is set to limit connection lifetime, this property determines whether or not log messages are generated when the pool closes connections due to maximum lifetime exceeded.
  `int`
  `getLoginTimeout()`
  BasicDataSource does NOT support this method.
  `PrintWriter`
  `getLogWriter()`
  Gets the log writer being used by this data source.
  `Duration`
  `getMaxConnDuration()`
  Gets the maximum permitted duration of a connection.
  `long`
  `getMaxConnLifetimeMillis()`
  Deprecated.
  Use `getMaxConnDuration()`.
  `int`
  `getMaxIdle()`
  Gets the maximum number of connections that can remain idle in the pool.
  `int`
  `getMaxOpenPreparedStatements()`
  Gets the value of the `maxOpenPreparedStatements` property.
  `int`
  `getMaxTotal()`
  Gets the maximum number of active connections that can be allocated at the same time.
  `Duration`
  `getMaxWaitDuration()`
  Gets the maximum Duration that the pool will wait for a connection to be returned before throwing an exception.
  `long`
  `getMaxWaitMillis()`
  Deprecated.
  Use `getMaxWaitDuration()`.
  `Duration`
  `getMinEvictableIdleDuration()`
  Gets the {code minEvictableIdleDuration} property.
  `long`
  `getMinEvictableIdleTimeMillis()`
  Deprecated.
  Use `getMinEvictableIdleDuration()`.
  `int`
  `getMinIdle()`
  Gets the minimum number of idle connections in the pool.
  `int`
  `getNumActive()`
  [Read Only] The current number of active connections that have been allocated from this data source.
  `int`
  `getNumIdle()`
  [Read Only] The current number of idle connections that are waiting to be allocated from this data source.
  `int`
  `getNumTestsPerEvictionRun()`
  Gets the value of the {code numTestsPerEvictionRun} property.
  `Logger`
  `getParentLogger()`
  `String`
  `getPassword()`
  Deprecated.
  Exposing passwords via JMX is an Information Exposure issue.
  `protected ObjectName`
  `getRegisteredJmxName()`
  Gets the registered JMX ObjectName.
  `boolean`
  `getRemoveAbandonedOnBorrow()`
  Flag to remove abandoned connections if they exceed the removeAbandonedTimeout when borrowObject is invoked.
  `boolean`
  `getRemoveAbandonedOnMaintenance()`
  Flag to remove abandoned connections if they exceed the removeAbandonedTimeout during pool maintenance.
  `int`
  `getRemoveAbandonedTimeout()`
  Deprecated.
  Use `getRemoveAbandonedTimeoutDuration()`.
  `Duration`
  `getRemoveAbandonedTimeoutDuration()`
  Gets the timeout before an abandoned connection can be removed.
  `boolean`
  `getRollbackOnReturn()`
  Gets the current value of the flag that controls whether a connection will be rolled back when it is returned to the pool if auto commit is not enabled and the connection is not read only.
  `Duration`
  `getSoftMinEvictableIdleDuration()`
  Gets the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.
  `long`
  `getSoftMinEvictableIdleTimeMillis()`
  Deprecated.
  Use `getSoftMinEvictableIdleDuration()`.
  `boolean`
  `getTestOnBorrow()`
  Gets the {code testOnBorrow} property.
  `boolean`
  `getTestOnCreate()`
  Gets the {code testOnCreate} property.
  `boolean`
  `getTestOnReturn()`
  Gets the value of the {code testOnReturn} property.
  `boolean`
  `getTestWhileIdle()`
  Gets the value of the {code testWhileIdle} property.
  `long`
  `getTimeBetweenEvictionRunsMillis()`
  Deprecated.
  Use `getDurationBetweenEvictionRuns()`.
  `String`
  `getUrl()`
  Gets the JDBC connection {code connectionString} property.
  `String`
  `getUsername()`
  Deprecated.
  Use `DataSourceMXBean.getUserName()`.
  `String`
  `getValidationQuery()`
  Gets the validation query used to validate connections before returning them.
  `int`
  `getValidationQueryTimeout()`
  Deprecated.
  Use `getValidationQueryTimeoutDuration()`.
  `Duration`
  `getValidationQueryTimeoutDuration()`
  Gets the validation query timeout.
  `void`
  `invalidateConnection(Connection connection)`
  Manually invalidates a connection, effectively requesting the pool to try to close it, remove it from the pool and reclaim pool capacity.
  `boolean`
  `isAccessToUnderlyingConnectionAllowed()`
  Gets the value of the accessToUnderlyingConnectionAllowed property.
  `boolean`
  `isClearStatementPoolOnReturn()`
  Returns true if the statement pool is cleared when the connection is returned to its pool.
  `boolean`
  `isClosed()`
  If true, this data source is closed and no more connections can be retrieved from this data source.
  `boolean`
  `isPoolPreparedStatements()`
  Returns true if we are pooling statements.
  `boolean`
  `isWrapperFor(Class<?> iface)`
  `protected void`
  `log(String message)`
  Logs the given message.
  `protected void`
  `log(String message, Throwable throwable)`
  Logs the given message and throwable.
  `void`
  `postDeregister()`
  `void`
  `postRegister(Boolean registrationDone)`
  `void`
  `preDeregister()`
  `ObjectName`
  `preRegister(MBeanServer server, ObjectName objectName)`
  `void`
  `removeConnectionProperty(String name)`
  Removes a custom connection property.
  `void`
  `restart()`
  Restarts the datasource.
  `void`
  `setAbandonedLogWriter(PrintWriter logWriter)`
  Sets the print writer to be used by this configuration to log information on abandoned objects.
  `void`
  `setAbandonedUsageTracking(boolean usageTracking)`
  If the connection pool implements `UsageTracking`, configure whether the connection pool should record a stack trace every time a method is called on a pooled connection and retain the most recent stack trace to aid debugging of abandoned connections.
  `void`
  `setAccessToUnderlyingConnectionAllowed(boolean allow)`
  Sets the value of the accessToUnderlyingConnectionAllowed property.
  `void`
  `setAutoCommitOnReturn(boolean autoCommitOnReturn)`
  Sets the value of the flag that controls whether or not connections being returned to the pool will be checked and configured with `Connection.setAutoCommit(true)` if the auto commit setting is `false` when the connection is returned.
  `void`
  `setCacheState(boolean cacheState)`
  Sets the state caching flag.
  `void`
  `setClearStatementPoolOnReturn(boolean clearStatementPoolOnReturn)`
  Sets whether the pool of statements (which was enabled with `setPoolPreparedStatements(boolean)`) should be cleared when the connection is returned to its pool.
  `void`
  `setConnectionFactoryClassName(String connectionFactoryClassName)`
  Sets the ConnectionFactory class name.
  `void`
  `setConnectionInitSqls(Collection<String> connectionInitSqls)`
  Sets the collection of SQL statements to be executed when a physical connection is first created.
  `void`
  `setConnectionInitSqls(List<String> connectionInitSqls)`
  Sets the list of SQL statements to be executed when a physical connection is first created.
  `void`
  `setConnectionProperties(String connectionProperties)`
  Sets the connection properties passed to driver.connect(...).
  `void`
  `setDefaultAutoCommit(Boolean defaultAutoCommit)`
  Sets default auto-commit state of connections returned by this datasource.
  `void`
  `setDefaultCatalog(String defaultCatalog)`
  Sets the default catalog.
  `void`
  `setDefaultQueryTimeout(Integer defaultQueryTimeoutSeconds)`
  Deprecated.
  Use `setDefaultQueryTimeout(Duration)`.
  `void`
  `setDefaultQueryTimeout(Duration defaultQueryTimeoutDuration)`
  Sets the default query timeout that will be used for `Statement`s created from this connection.
  `void`
  `setDefaultReadOnly(Boolean defaultReadOnly)`
  Sets defaultReadonly property.
  `void`
  `setDefaultSchema(String defaultSchema)`
  Sets the default schema.
  `void`
  `setDefaultTransactionIsolation(int defaultTransactionIsolation)`
  Sets the default transaction isolation state for returned connections.
  `void`
  `setDisconnectionIgnoreSqlCodes(Collection<String> disconnectionIgnoreSqlCodes)`
  Sets the SQL State codes that should be ignored when determining fatal disconnection conditions.
  `void`
  `setDisconnectionSqlCodes(Collection<String> disconnectionSqlCodes)`
  Sets the SQL State codes considered to signal fatal conditions.
  `void`
  `setDriver(Driver driver)`
  Sets the JDBC Driver instance to use for this pool.
  `void`
  `setDriverClassLoader(ClassLoader driverClassLoader)`
  Sets the class loader to be used to load the JDBC driver.
  `void`
  `setDriverClassName(String driverClassName)`
  Sets the JDBC driver class name.
  `void`
  `setDurationBetweenEvictionRuns(Duration timeBetweenEvictionRunsMillis)`
  Sets the {code durationBetweenEvictionRuns} property.
  `void`
  `setEnableAutoCommitOnReturn(boolean autoCommitOnReturn)`
  Deprecated.
  Use `setAutoCommitOnReturn(boolean)`.
  `void`
  `setEvictionPolicyClassName(String evictionPolicyClassName)`
  Sets the EvictionPolicy implementation to use with this connection pool.
  `void`
  `setFastFailValidation(boolean fastFailValidation)`
  `void`
  `setInitialSize(int initialSize)`
  Sets the initial size of the connection pool.
  `void`
  `setJmxName(String jmxName)`
  Sets the JMX name that has been requested for this DataSource.
  `void`
  `setLifo(boolean lifo)`
  Sets the LIFO property.
  `void`
  `setLogAbandoned(boolean logAbandoned)`
  `void`
  `setLogExpiredConnections(boolean logExpiredConnections)`
  When `getMaxConnDuration()` is set to limit connection lifetime, this property determines whether or not log messages are generated when the pool closes connections due to maximum lifetime exceeded.
  `void`
  `setLoginTimeout(int loginTimeout)`
  BasicDataSource does NOT support this method.
  `void`
  `setLogWriter(PrintWriter logWriter)`
  Sets the log writer being used by this data source.
  `void`
  `setMaxConn(Duration maxConnDuration)`
  Sets the maximum permitted lifetime of a connection.
  `void`
  `setMaxConnLifetimeMillis(long maxConnLifetimeMillis)`
  Deprecated.
  Use `setMaxConn(Duration)`.
  `void`
  `setMaxIdle(int maxIdle)`
  Sets the maximum number of connections that can remain idle in the pool.
  `void`
  `setMaxOpenPreparedStatements(int maxOpenStatements)`
  Sets the value of the `maxOpenPreparedStatements` property.
  `void`
  `setMaxTotal(int maxTotal)`
  Sets the maximum total number of idle and borrows connections that can be active at the same time.
  `void`
  `setMaxWait(Duration maxWaitDuration)`
  Sets the MaxWaitMillis property.
  `void`
  `setMaxWaitMillis(long maxWaitMillis)`
  Deprecated.
  `setMaxWait(Duration)`.
  `void`
  `setMinEvictableIdle(Duration minEvictableIdleDuration)`
  Sets the {code minEvictableIdleDuration} property.
  `void`
  `setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)`
  Deprecated.
  Use `setMinEvictableIdle(Duration)`.
  `void`
  `setMinIdle(int minIdle)`
  Sets the minimum number of idle connections in the pool.
  `void`
  `setNumTestsPerEvictionRun(int numTestsPerEvictionRun)`
  Sets the value of the {code numTestsPerEvictionRun} property.
  `void`
  `setPassword(String password)`
  Sets the {code password}.
  `void`
  `setPoolPreparedStatements(boolean poolingStatements)`
  Sets whether to pool statements or not.
  `void`
  `setRegisterConnectionMBean(boolean registerConnectionMBean)`
  Sets if connection level JMX tracking is requested for this DataSource.
  `void`
  `setRemoveAbandonedOnBorrow(boolean removeAbandonedOnBorrow)`
  `void`
  `setRemoveAbandonedOnMaintenance(boolean removeAbandonedOnMaintenance)`
  `void`
  `setRemoveAbandonedTimeout(int removeAbandonedTimeout)`
  Deprecated.
  Use `setRemoveAbandonedTimeout(Duration)`.
  `void`
  `setRemoveAbandonedTimeout(Duration removeAbandonedTimeout)`
  Sets the timeout before an abandoned connection can be removed.
  `void`
  `setRollbackOnReturn(boolean rollbackOnReturn)`
  Sets the flag that controls if a connection will be rolled back when it is returned to the pool if auto commit is not enabled and the connection is not read only.
  `void`
  `setSoftMinEvictableIdle(Duration softMinEvictableIdleTimeMillis)`
  Sets the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.
  `void`
  `setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis)`
  Deprecated.
  Use `setSoftMinEvictableIdle(Duration)`.
  `void`
  `setTestOnBorrow(boolean testOnBorrow)`
  Sets the {code testOnBorrow} property.
  `void`
  `setTestOnCreate(boolean testOnCreate)`
  Sets the {code testOnCreate} property.
  `void`
  `setTestOnReturn(boolean testOnReturn)`
  Sets the `testOnReturn` property.
  `void`
  `setTestWhileIdle(boolean testWhileIdle)`
  Sets the `testWhileIdle` property.
  `void`
  `setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)`
  Deprecated.
  Use `setDurationBetweenEvictionRuns(Duration)`.
  `void`
  `setUrl(String connectionString)`
  Sets the {code connection string}.
  `void`
  `setUsername(String userName)`
  Sets the {code userName}.
  `void`
  `setValidationQuery(String validationQuery)`
  Sets the {code validationQuery}.
  `void`
  `setValidationQueryTimeout(int validationQueryTimeoutSeconds)`
  Deprecated.
  Use `setValidationQueryTimeout(Duration)`.
  `void`
  `setValidationQueryTimeout(Duration validationQueryTimeoutDuration)`
  Sets the validation query timeout, the amount of time, in seconds, that connection validation will wait for a response from the database when executing a validation query.
  `void`
  `start()`
  Starts the datasource.
  `protected void`
  `startPoolMaintenance()`
  Starts the connection pool maintenance task, if configured.
  `<T> T`
  `unwrap(Class<T> iface)`
  `protected static void`
  `validateConnectionFactory(PoolableConnectionFactory connectionFactory)`
  Validates the given factory.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.apache.commons.dbcp2.DataSourceMXBean

  `getUserName`

- ## Constructor Details

  - ### BasicDataSource

    public BasicDataSource()

- ## Method Details

  - ### validateConnectionFactory

    protected static void validateConnectionFactory(PoolableConnectionFactory connectionFactory) throws SQLException
    Validates the given factory.
    Parameters:
      `connectionFactory` - the factory
    Throws:
      `SQLException` - Thrown by one of the factory methods while managing a temporary pooled object.

  - ### addConnectionProperty

    public void addConnectionProperty(String name, String value)
    Adds a custom connection property to the set that will be passed to our JDBC driver. This MUST be called before the first connection is retrieved (along with all the other configuration property setters). Calls to this method after the connection pool has been initialized have no effect.
    Parameters:
      `name` - Name of the custom connection property
      `value` - Value of the custom connection property

  - ### close

    public void close() throws SQLException
    Closes and releases all idle connections that are currently stored in the connection pool associated with this data source.

    Connections that are checked out to clients when this method is invoked are not affected. When client applications subsequently invoke `Connection.close()` to return these connections to the pool, the underlying JDBC connections are closed.

    Attempts to acquire connections using `getConnection()` after this method has been invoked result in SQLExceptions. To reopen a datasource that has been closed using this method, use `start()`.

    This method is idempotent - i.e., closing an already closed BasicDataSource has no effect and does not generate exceptions.

    Specified by:
      `close` in interface `AutoCloseable`
    Throws:
      `SQLException` - if an error occurs closing idle connections

  - ### createConnectionFactory

    protected ConnectionFactory createConnectionFactory() throws SQLException
    Creates a JDBC connection factory for this data source. The JDBC driver is loaded using the following algorithm:
    1. If a Driver instance has been specified via `setDriver(Driver)` use it
    2. If no Driver instance was specified and {code driverClassName} is specified that class is loaded using the `ClassLoader` of this class or, if {code driverClassLoader} is set, {code driverClassName} is loaded with the specified `ClassLoader`.
    3. If {code driverClassName} is specified and the previous attempt fails, the class is loaded using the context class loader of the current thread.
    4. If a driver still isn't loaded one is loaded via the `DriverManager` using the specified {code connectionString}.

    This method exists so subclasses can replace the implementation class.

    Returns:
      A new connection factory.
    Throws:
      `SQLException` - If the connection factory cannot be created

  - ### createConnectionPool

    protected void createConnectionPool(PoolableConnectionFactory factory)
    Creates a connection pool for this datasource. This method only exists so subclasses can replace the implementation class.

    This implementation configures all pool properties other than timeBetweenEvictionRunsMillis. Setting that property is deferred to `startPoolMaintenance()`, since setting timeBetweenEvictionRunsMillis to a positive value causes `GenericObjectPool`'s eviction timer to be started.

    Parameters:
      `factory` - The factory to use to create new connections for this pool.

  - ### createDataSource

    protected DataSource createDataSource() throws SQLException
    Creates (if necessary) and return the internal data source we are using to manage our connections.
    Returns:
      The current internal DataSource or a newly created instance if it has not yet been created.
    Throws:
      `SQLException` - if the object pool cannot be created.

  - ### createDataSourceInstance

    protected DataSource createDataSourceInstance() throws SQLException
    Creates the actual data source instance. This method only exists so that subclasses can replace the implementation class.
    Returns:
      A new DataSource instance
    Throws:
      `SQLException` - if unable to create a datasource instance

  - ### createObjectPool

    protected GenericObjectPool<PoolableConnection> createObjectPool(PoolableConnectionFactory factory, GenericObjectPoolConfig<PoolableConnection> poolConfig, AbandonedConfig abandonedConfig)
    Creates an object pool used to provide pooling support for `JDBC connections`.
    Parameters:
      `factory` - the object factory
      `poolConfig` - the object pool configuration
      `abandonedConfig` - the abandoned objects configuration
    Returns:
      a non-null instance

  - ### createPoolableConnectionFactory

    protected PoolableConnectionFactory createPoolableConnectionFactory(ConnectionFactory driverConnectionFactory) throws SQLException
    Creates the PoolableConnectionFactory and attaches it to the connection pool. This method only exists so subclasses can replace the default implementation.
    Parameters:
      `driverConnectionFactory` - JDBC connection factory
    Returns:
      A new PoolableConnectionFactory configured with the current configuration of this BasicDataSource
    Throws:
      `SQLException` - if an error occurs creating the PoolableConnectionFactory

  - ### evict

    public void evict() throws Exception
    Manually evicts idle connections
    Throws:
      `Exception` - when there is a problem evicting idle objects.

  - ### getAbandonedLogWriter

    public PrintWriter getAbandonedLogWriter()
    Gets the print writer used by this configuration to log information on abandoned objects.
    Returns:
      The print writer used by this configuration to log information on abandoned objects.

  - ### getAbandonedUsageTracking

    public boolean getAbandonedUsageTracking()
    If the connection pool implements `UsageTracking`, should the connection pool record a stack trace every time a method is called on a pooled connection and retain the most recent stack trace to aid debugging of abandoned connections?
    Specified by:
      `getAbandonedUsageTracking` in interface `DataSourceMXBean`
    Returns:
      `true` if usage tracking is enabled

  - ### getAutoCommitOnReturn

    public boolean getAutoCommitOnReturn()
    Gets the value of the flag that controls whether or not connections being returned to the pool will be checked and configured with `Connection.setAutoCommit(true)` if the auto commit setting is `false` when the connection is returned. It is `true` by default.
    Returns:
      Whether or not connections being returned to the pool will be checked and configured with auto-commit.

  - ### getCacheState

    public boolean getCacheState()
    Gets the state caching flag.
    Specified by:
      `getCacheState` in interface `DataSourceMXBean`
    Returns:
      the state caching flag

  - ### getConnection

    public Connection getConnection() throws SQLException
    Creates (if necessary) and return a connection to the database.
    Specified by:
      `getConnection` in interface `DataSource`
    Returns:
      a database connection
    Throws:
      `SQLException` - if a database access error occurs

  - ### getConnection

    public Connection getConnection(String user, String pass) throws SQLException
    BasicDataSource does NOT support this method.
    Specified by:
      `getConnection` in interface `DataSource`
    Parameters:
      `user` - Database user on whose behalf the Connection is being made
      `pass` - The database user's password
    Returns:
      nothing - always throws UnsupportedOperationException
    Throws:
      `UnsupportedOperationException` - always thrown.
      `SQLException` - if a database access error occurs

  - ### getConnectionFactoryClassName

    public String getConnectionFactoryClassName()
    Gets the ConnectionFactoryClassName that has been configured for use by this pool.

    Note: This getter only returns the last value set by a call to `setConnectionFactoryClassName(String)`.

    Returns:
      the ConnectionFactoryClassName that has been configured for use by this pool.
    Since:
      2.7.0

  - ### getConnectionInitSqls

    public List<String> getConnectionInitSqls()
    Gets the list of SQL statements executed when a physical connection is first created. Returns an empty list if there are no initialization statements configured.
    Returns:
      initialization SQL statements

  - ### getConnectionInitSqlsAsArray

    public String[] getConnectionInitSqlsAsArray()
    Provides the same data as `getConnectionInitSqls()` but in an array so it is accessible via JMX.
    Specified by:
      `getConnectionInitSqlsAsArray` in interface `DataSourceMXBean`
    Returns:
      `getConnectionInitSqlsAsArray()`.

  - ### getConnectionPool

    public GenericObjectPool<PoolableConnection> getConnectionPool()
    Gets the underlying connection pool.
    Returns:
      the underlying connection pool.
    Since:
      2.10.0

  - ### getDefaultAutoCommit

    public Boolean getDefaultAutoCommit()
    Gets the default auto-commit property.
    Specified by:
      `getDefaultAutoCommit` in interface `DataSourceMXBean`
    Returns:
      true if default auto-commit is enabled

  - ### getDefaultCatalog

    public String getDefaultCatalog()
    Gets the default catalog.
    Specified by:
      `getDefaultCatalog` in interface `DataSourceMXBean`
    Returns:
      the default catalog

  - ### getDefaultQueryTimeout

    @Deprecated public Integer getDefaultQueryTimeout()
    Deprecated.
    Use `getDefaultQueryTimeoutDuration()`.
    Gets the default query timeout that will be used for `Statement`s created from this connection. `null` means that the driver default will be used.
    Returns:
      The default query timeout in seconds.

  - ### getDefaultQueryTimeoutDuration

    public Duration getDefaultQueryTimeoutDuration()
    Gets the default query timeout that will be used for `Statement`s created from this connection. `null` means that the driver default will be used.
    Returns:
      The default query timeout Duration.
    Since:
      2.10.0

  - ### getDefaultReadOnly

    public Boolean getDefaultReadOnly()
    Gets the default readOnly property.
    Specified by:
      `getDefaultReadOnly` in interface `DataSourceMXBean`
    Returns:
      true if connections are readOnly by default

  - ### getDefaultSchema

    public String getDefaultSchema()
    Gets the default schema.
    Specified by:
      `getDefaultSchema` in interface `DataSourceMXBean`
    Returns:
      the default schema.
    Since:
      2.5.0

  - ### getDefaultTransactionIsolation

    public int getDefaultTransactionIsolation()
    Gets the default transaction isolation state of returned connections.
    Specified by:
      `getDefaultTransactionIsolation` in interface `DataSourceMXBean`
    Returns:
      the default value for transaction isolation state
    See Also:
      - `Connection.getTransactionIsolation()`

  - ### getDisconnectionIgnoreSqlCodes

    public Set<String> getDisconnectionIgnoreSqlCodes()
    Gets the set of SQL State codes that are not considered fatal disconnection codes.

    This method returns the set of SQL State codes that have been specified to be ignored when determining if a `SQLException` signals a disconnection. These codes will not trigger a disconnection even if they match other disconnection criteria.

    Returns:
      a set of SQL State codes that should be ignored for disconnection checks, or an empty set if none have been specified.
    Since:
      2.13.0

  - ### getDisconnectionIgnoreSqlCodesAsArray

    public String[] getDisconnectionIgnoreSqlCodesAsArray()
    Provides the same data as `getDisconnectionIgnoreSqlCodes()` but in an array, so it is accessible via JMX.
    Specified by:
      `getDisconnectionIgnoreSqlCodesAsArray` in interface `DataSourceMXBean`
    Returns:
      `getDisconnectionIgnoreSqlCodesAsArray()`.
    Since:
      2.13.0

  - ### getDisconnectionSqlCodes

    public Set<String> getDisconnectionSqlCodes()
    Gets the set of SQL State codes considered to signal fatal conditions.
    Returns:
      fatal disconnection state codes
    Since:
      2.1
    See Also:
      - `setDisconnectionSqlCodes(Collection)`

  - ### getDisconnectionSqlCodesAsArray

    public String[] getDisconnectionSqlCodesAsArray()
    Provides the same data as `getDisconnectionSqlCodes()` but in an array so it is accessible via JMX.
    Specified by:
      `getDisconnectionSqlCodesAsArray` in interface `DataSourceMXBean`
    Returns:
      `getDisconnectionSqlCodesAsArray()`.
    Since:
      2.1

  - ### getDriver

    public Driver getDriver()
    Gets the JDBC Driver that has been configured for use by this pool.

    Note: This getter only returns the last value set by a call to `setDriver(Driver)`. It does not return any driver instance that may have been created from the value set via `setDriverClassName(String)`.

    Returns:
      the JDBC Driver that has been configured for use by this pool

  - ### getDriverClassLoader

    public ClassLoader getDriverClassLoader()
    Gets the class loader specified for loading the JDBC driver. Returns `null` if no class loader has been explicitly specified.

    Note: This getter only returns the last value set by a call to `setDriverClassLoader(ClassLoader)`. It does not return the class loader of any driver that may have been set via `setDriver(Driver)`.

    Returns:
      The class loader specified for loading the JDBC driver.

  - ### getDriverClassName

    public String getDriverClassName()
    Gets the JDBC driver class name.

    Note: This getter only returns the last value set by a call to `setDriverClassName(String)`. It does not return the class name of any driver that may have been set via `setDriver(Driver)`.

    Specified by:
      `getDriverClassName` in interface `DataSourceMXBean`
    Returns:
      the JDBC driver class name

  - ### getDurationBetweenEvictionRuns

    public Duration getDurationBetweenEvictionRuns()
    Gets the value of the {code durationBetweenEvictionRuns} property.
    Returns:
      the time (in milliseconds) between evictor runs
    Since:
      2.10.0
    See Also:
      - `setDurationBetweenEvictionRuns(Duration)`

  - ### getEnableAutoCommitOnReturn

    @Deprecated public boolean getEnableAutoCommitOnReturn()
    Deprecated.
    Use `getAutoCommitOnReturn()`.
    Gets the value of the flag that controls whether or not connections being returned to the pool will be checked and configured with `Connection.setAutoCommit(true)` if the auto commit setting is `false` when the connection is returned. It is `true` by default.
    Returns:
      Whether or not connections being returned to the pool will be checked and configured with auto-commit.

  - ### getEvictionPolicyClassName

    public String getEvictionPolicyClassName()
    Gets the EvictionPolicy implementation in use with this connection pool.
    Returns:
      The EvictionPolicy implementation in use with this connection pool.

  - ### getFastFailValidation

    public boolean getFastFailValidation()
    True means that validation will fail immediately for connections that have previously thrown SQLExceptions with SQL State indicating fatal disconnection errors.
    Specified by:
      `getFastFailValidation` in interface `DataSourceMXBean`
    Returns:
      true if connections created by this datasource will fast fail validation.
    Since:
      2.1
    See Also:
      - `setDisconnectionSqlCodes(Collection)`
      - `setDisconnectionIgnoreSqlCodes(Collection)`

  - ### getInitialSize

    public int getInitialSize()
    Gets the initial size of the connection pool.
    Specified by:
      `getInitialSize` in interface `DataSourceMXBean`
    Returns:
      the number of connections created when the pool is initialized

  - ### getJmxName

    public String getJmxName()
    Gets the JMX name that has been requested for this DataSource. If the requested name is not valid, an alternative may be chosen.
    Returns:
      The JMX name that has been requested for this DataSource.

  - ### getLifo

    public boolean getLifo()
    Gets the LIFO property.
    Specified by:
      `getLifo` in interface `DataSourceMXBean`
    Returns:
      true if connection pool behaves as a LIFO queue.

  - ### getLogAbandoned

    public boolean getLogAbandoned()
    Flag to log stack traces for application code which abandoned a Statement or Connection.

    Defaults to false.

    Logging of abandoned Statements and Connections adds overhead for every Connection open or new Statement because a stack trace has to be generated.

    Specified by:
      `getLogAbandoned` in interface `DataSourceMXBean`
    Returns:
      `getLogAbandoned()`.

  - ### getLogExpiredConnections

    public boolean getLogExpiredConnections()
    When `getMaxConnDuration()` is set to limit connection lifetime, this property determines whether or not log messages are generated when the pool closes connections due to maximum lifetime exceeded.
    Specified by:
      `getLogExpiredConnections` in interface `DataSourceMXBean`
    Returns:
      `getLogExpiredConnections()`.
    Since:
      2.1

  - ### getLoginTimeout

    public int getLoginTimeout() throws SQLException
    BasicDataSource does NOT support this method.

    Gets the login timeout (in seconds) for connecting to the database.

    Calls `createDataSource()`, so has the side effect of initializing the connection pool.

    Specified by:
      `getLoginTimeout` in interface `CommonDataSource`
    Returns:
      login timeout in seconds
    Throws:
      `SQLException` - if a database access error occurs
      `UnsupportedOperationException` - If the DataSource implementation does not support the login timeout feature.

  - ### getLogWriter

    public PrintWriter getLogWriter() throws SQLException
    Gets the log writer being used by this data source.

    Calls `createDataSource()`, so has the side effect of initializing the connection pool.

    Specified by:
      `getLogWriter` in interface `CommonDataSource`
    Returns:
      log writer in use
    Throws:
      `SQLException` - if a database access error occurs

  - ### getMaxConnDuration

    public Duration getMaxConnDuration()
    Gets the maximum permitted duration of a connection. A value of zero or less indicates an infinite lifetime.
    Returns:
      the maximum permitted duration of a connection.
    Since:
      2.10.0

  - ### getMaxConnLifetimeMillis

    @Deprecated public long getMaxConnLifetimeMillis()
    Deprecated.
    Use `getMaxConnDuration()`.
    Gets the maximum permitted lifetime of a connection in milliseconds. A value of zero or less indicates an infinite lifetime.
    Specified by:
      `getMaxConnLifetimeMillis` in interface `DataSourceMXBean`
    Returns:
      `getMaxConnLifetimeMillis()`.

  - ### getMaxIdle

    public int getMaxIdle()
    Gets the maximum number of connections that can remain idle in the pool. Excess idle connections are destroyed on return to the pool.

    A negative value indicates that there is no limit

    Specified by:
      `getMaxIdle` in interface `DataSourceMXBean`
    Returns:
      the maximum number of idle connections

  - ### getMaxOpenPreparedStatements

    public int getMaxOpenPreparedStatements()
    Gets the value of the `maxOpenPreparedStatements` property.
    Specified by:
      `getMaxOpenPreparedStatements` in interface `DataSourceMXBean`
    Returns:
      the maximum number of open statements

  - ### getMaxTotal

    public int getMaxTotal()
    Gets the maximum number of active connections that can be allocated at the same time.

    A negative number means that there is no limit.

    Specified by:
      `getMaxTotal` in interface `DataSourceMXBean`
    Returns:
      the maximum number of active connections

  - ### getMaxWaitDuration

    public Duration getMaxWaitDuration()
    Gets the maximum Duration that the pool will wait for a connection to be returned before throwing an exception. A value less than or equal to zero means the pool is set to wait indefinitely.
    Returns:
      the maxWaitDuration property value.
    Since:
      2.10.0

  - ### getMaxWaitMillis

    @Deprecated public long getMaxWaitMillis()
    Deprecated.
    Use `getMaxWaitDuration()`.
    Gets the maximum number of milliseconds that the pool will wait for a connection to be returned before throwing an exception. A value less than or equal to zero means the pool is set to wait indefinitely.
    Specified by:
      `getMaxWaitMillis` in interface `DataSourceMXBean`
    Returns:
      the maxWaitMillis property value.

  - ### getMinEvictableIdleDuration

    public Duration getMinEvictableIdleDuration()
    Gets the {code minEvictableIdleDuration} property.
    Returns:
      the value of the {code minEvictableIdleDuration} property
    Since:
      2.10.0
    See Also:
      - `setMinEvictableIdle(Duration)`

  - ### getMinEvictableIdleTimeMillis

    @Deprecated public long getMinEvictableIdleTimeMillis()
    Deprecated.
    Use `getMinEvictableIdleDuration()`.
    Gets the {code minEvictableIdleDuration} property.
    Specified by:
      `getMinEvictableIdleTimeMillis` in interface `DataSourceMXBean`
    Returns:
      the value of the {code minEvictableIdleDuration} property
    See Also:
      - `setMinEvictableIdle(Duration)`

  - ### getMinIdle

    public int getMinIdle()
    Gets the minimum number of idle connections in the pool. The pool attempts to ensure that minIdle connections are available when the idle object evictor runs. The value of this property has no effect unless {code durationBetweenEvictionRuns} has a positive value.
    Specified by:
      `getMinIdle` in interface `DataSourceMXBean`
    Returns:
      the minimum number of idle connections
    See Also:
      - `GenericObjectPool.getMinIdle()`

  - ### getNumActive

    public int getNumActive()
    [Read Only] The current number of active connections that have been allocated from this data source.
    Specified by:
      `getNumActive` in interface `DataSourceMXBean`
    Returns:
      the current number of active connections

  - ### getNumIdle

    public int getNumIdle()
    [Read Only] The current number of idle connections that are waiting to be allocated from this data source.
    Specified by:
      `getNumIdle` in interface `DataSourceMXBean`
    Returns:
      the current number of idle connections

  - ### getNumTestsPerEvictionRun

    public int getNumTestsPerEvictionRun()
    Gets the value of the {code numTestsPerEvictionRun} property.
    Specified by:
      `getNumTestsPerEvictionRun` in interface `DataSourceMXBean`
    Returns:
      the number of objects to examine during idle object evictor runs
    See Also:
      - `setNumTestsPerEvictionRun(int)`

  - ### getParentLogger

    public Logger getParentLogger() throws SQLFeatureNotSupportedException
    Specified by:
      `getParentLogger` in interface `CommonDataSource`
    Throws:
      `SQLFeatureNotSupportedException`

  - ### getPassword

    @Deprecated public String getPassword()
    Deprecated.
    Exposing passwords via JMX is an Information Exposure issue.
    Gets the password passed to the JDBC driver to establish connections.
    Specified by:
      `getPassword` in interface `BasicDataSourceMXBean`
    Returns:
      the connection password

  - ### getRegisteredJmxName

    protected ObjectName getRegisteredJmxName()
    Gets the registered JMX ObjectName.
    Returns:
      the registered JMX ObjectName.

  - ### getRemoveAbandonedOnBorrow

    public boolean getRemoveAbandonedOnBorrow()
    Flag to remove abandoned connections if they exceed the removeAbandonedTimeout when borrowObject is invoked.

    The default value is false.

    If set to true a connection is considered abandoned and eligible for removal if it has not been used for more than `removeAbandonedTimeout` seconds.

    Abandoned connections are identified and removed when `getConnection()` is invoked and all of the following conditions hold:

    - `getRemoveAbandonedOnBorrow()`
    - `getNumActive()` > `getMaxTotal()` - 3
    - `getNumIdle()` < 2
    Specified by:
      `getRemoveAbandonedOnBorrow` in interface `DataSourceMXBean`
    Returns:
      `getRemoveAbandonedOnBorrow()`.
    See Also:
      - `getRemoveAbandonedTimeoutDuration()`

  - ### getRemoveAbandonedOnMaintenance

    public boolean getRemoveAbandonedOnMaintenance()
    Flag to remove abandoned connections if they exceed the removeAbandonedTimeout during pool maintenance.

    The default value is false.

    If set to true a connection is considered abandoned and eligible for removal if it has not been used for more than `removeAbandonedTimeout` seconds.

    Specified by:
      `getRemoveAbandonedOnMaintenance` in interface `DataSourceMXBean`
    Returns:
      `getRemoveAbandonedOnMaintenance()`.
    See Also:
      - `getRemoveAbandonedTimeoutDuration()`

  - ### getRemoveAbandonedTimeout

    @Deprecated public int getRemoveAbandonedTimeout()
    Deprecated.
    Use `getRemoveAbandonedTimeoutDuration()`.
    Gets the timeout in seconds before an abandoned connection can be removed.

    Creating a Statement, PreparedStatement or CallableStatement or using one of these to execute a query (using one of the execute methods) resets the lastUsed property of the parent connection.

    Abandoned connection cleanup happens when:

    - `getRemoveAbandonedOnBorrow()` or `getRemoveAbandonedOnMaintenance()` = true
    - `numIdle` < 2
    - `numActive` > `maxTotal` - 3

    The default value is 300 seconds.

    Specified by:
      `getRemoveAbandonedTimeout` in interface `DataSourceMXBean`
    Returns:
      `getRemoveAbandonedTimeout()`.

  - ### getRemoveAbandonedTimeoutDuration

    public Duration getRemoveAbandonedTimeoutDuration()
    Gets the timeout before an abandoned connection can be removed.

    Creating a Statement, PreparedStatement or CallableStatement or using one of these to execute a query (using one of the execute methods) resets the lastUsed property of the parent connection.

    Abandoned connection cleanup happens when:

    - `getRemoveAbandonedOnBorrow()` or `getRemoveAbandonedOnMaintenance()` = true
    - `numIdle` < 2
    - `numActive` > `maxTotal` - 3

    The default value is 300 seconds.

    Returns:
      Timeout before an abandoned connection can be removed.
    Since:
      2.10.0

  - ### getRollbackOnReturn

    public boolean getRollbackOnReturn()
    Gets the current value of the flag that controls whether a connection will be rolled back when it is returned to the pool if auto commit is not enabled and the connection is not read only.
    Returns:
      whether a connection will be rolled back when it is returned to the pool.

  - ### getSoftMinEvictableIdleDuration

    public Duration getSoftMinEvictableIdleDuration()
    Gets the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.

    When `minEvictableIdleTimeMillis` is set to a positive value, minEvictableIdleTimeMillis is examined first by the idle connection evictor - i.e. when idle connections are visited by the evictor, idle time is first compared against `minEvictableIdleTimeMillis` (without considering the number of idle connections in the pool) and then against `softMinEvictableIdleTimeMillis`, including the `minIdle`, constraint.

    Returns:
      minimum amount of time a connection may sit idle in the pool before it is eligible for eviction, assuming there are minIdle idle connections in the pool
    Since:
      2.10.0

  - ### getSoftMinEvictableIdleTimeMillis

    @Deprecated public long getSoftMinEvictableIdleTimeMillis()
    Deprecated.
    Use `getSoftMinEvictableIdleDuration()`.
    Gets the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.

    When `minEvictableIdleTimeMillis` is set to a positive value, minEvictableIdleTimeMillis is examined first by the idle connection evictor - i.e. when idle connections are visited by the evictor, idle time is first compared against `minEvictableIdleTimeMillis` (without considering the number of idle connections in the pool) and then against `softMinEvictableIdleTimeMillis`, including the `minIdle`, constraint.

    Specified by:
      `getSoftMinEvictableIdleTimeMillis` in interface `DataSourceMXBean`
    Returns:
      minimum amount of time a connection may sit idle in the pool before it is eligible for eviction, assuming there are minIdle idle connections in the pool

  - ### getTestOnBorrow

    public boolean getTestOnBorrow()
    Gets the {code testOnBorrow} property.
    Specified by:
      `getTestOnBorrow` in interface `DataSourceMXBean`
    Returns:
      true if objects are validated before being borrowed from the pool
    See Also:
      - `setTestOnBorrow(boolean)`

  - ### getTestOnCreate

    public boolean getTestOnCreate()
    Gets the {code testOnCreate} property.
    Specified by:
      `getTestOnCreate` in interface `DataSourceMXBean`
    Returns:
      true if objects are validated immediately after they are created by the pool
    See Also:
      - `setTestOnCreate(boolean)`

  - ### getTestOnReturn

    public boolean getTestOnReturn()
    Gets the value of the {code testOnReturn} property.
    Returns:
      true if objects are validated before being returned to the pool
    See Also:
      - `setTestOnReturn(boolean)`

  - ### getTestWhileIdle

    public boolean getTestWhileIdle()
    Gets the value of the {code testWhileIdle} property.
    Specified by:
      `getTestWhileIdle` in interface `DataSourceMXBean`
    Returns:
      true if objects examined by the idle object evictor are validated
    See Also:
      - `setTestWhileIdle(boolean)`

  - ### getTimeBetweenEvictionRunsMillis

    @Deprecated public long getTimeBetweenEvictionRunsMillis()
    Deprecated.
    Use `getDurationBetweenEvictionRuns()`.
    Gets the value of the {code durationBetweenEvictionRuns} property.
    Specified by:
      `getTimeBetweenEvictionRunsMillis` in interface `DataSourceMXBean`
    Returns:
      the time (in milliseconds) between evictor runs
    See Also:
      - `setDurationBetweenEvictionRuns(Duration)`

  - ### getUrl

    public String getUrl()
    Gets the JDBC connection {code connectionString} property.
    Specified by:
      `getUrl` in interface `DataSourceMXBean`
    Returns:
      the {code connectionString} passed to the JDBC driver to establish connections

  - ### getUsername

    @Deprecated public String getUsername()
    Deprecated.
    Use `DataSourceMXBean.getUserName()`.
    Gets the JDBC connection {code userName} property.
    Specified by:
      `getUsername` in interface `DataSourceMXBean`
    Returns:
      the {code userName} passed to the JDBC driver to establish connections

  - ### getValidationQuery

    public String getValidationQuery()
    Gets the validation query used to validate connections before returning them.
    Specified by:
      `getValidationQuery` in interface `DataSourceMXBean`
    Returns:
      the SQL validation query
    See Also:
      - `setValidationQuery(String)`

  - ### getValidationQueryTimeout

    @Deprecated public int getValidationQueryTimeout()
    Deprecated.
    Use `getValidationQueryTimeoutDuration()`.
    Gets the validation query timeout.
    Specified by:
      `getValidationQueryTimeout` in interface `DataSourceMXBean`
    Returns:
      the timeout in seconds before connection validation queries fail.

  - ### getValidationQueryTimeoutDuration

    public Duration getValidationQueryTimeoutDuration()
    Gets the validation query timeout.
    Returns:
      the timeout in seconds before connection validation queries fail.

  - ### invalidateConnection

    public void invalidateConnection(Connection connection) throws IllegalStateException
    Manually invalidates a connection, effectively requesting the pool to try to close it, remove it from the pool and reclaim pool capacity.
    Parameters:
      `connection` - The Connection to invalidate.
    Throws:
      `IllegalStateException` - if invalidating the connection failed.
    Since:
      2.1

  - ### isAccessToUnderlyingConnectionAllowed

    public boolean isAccessToUnderlyingConnectionAllowed()
    Gets the value of the accessToUnderlyingConnectionAllowed property.
    Specified by:
      `isAccessToUnderlyingConnectionAllowed` in interface `DataSourceMXBean`
    Returns:
      true if access to the underlying connection is allowed, false otherwise.

  - ### isClearStatementPoolOnReturn

    public boolean isClearStatementPoolOnReturn()
    Returns true if the statement pool is cleared when the connection is returned to its pool.
    Specified by:
      `isClearStatementPoolOnReturn` in interface `DataSourceMXBean`
    Returns:
      true if the statement pool is cleared at connection return
    Since:
      2.8.0

  - ### isClosed

    public boolean isClosed()
    If true, this data source is closed and no more connections can be retrieved from this data source.
    Specified by:
      `isClosed` in interface `DataSourceMXBean`
    Returns:
      true, if the data source is closed; false otherwise

  - ### isPoolPreparedStatements

    public boolean isPoolPreparedStatements()
    Returns true if we are pooling statements.
    Specified by:
      `isPoolPreparedStatements` in interface `DataSourceMXBean`
    Returns:
      true if prepared and callable statements are pooled

  - ### isWrapperFor

    public boolean isWrapperFor(Class<?> iface) throws SQLException
    Specified by:
      `isWrapperFor` in interface `Wrapper`
    Throws:
      `SQLException`

  - ### log

    protected void log(String message)
    Logs the given message.
    Parameters:
      `message` - the message to log.

  - ### log

    protected void log(String message, Throwable throwable)
    Logs the given message and throwable.
    Parameters:
      `message` - value to be log.
      `throwable` - the throwable.
    Since:
      2.7.0

  - ### postDeregister

    public void postDeregister()
    Specified by:
      `postDeregister` in interface `MBeanRegistration`

  - ### postRegister

    public void postRegister(Boolean registrationDone)
    Specified by:
      `postRegister` in interface `MBeanRegistration`

  - ### preDeregister

    public void preDeregister() throws Exception
    Specified by:
      `preDeregister` in interface `MBeanRegistration`
    Throws:
      `Exception`

  - ### preRegister

    public ObjectName preRegister(MBeanServer server, ObjectName objectName)
    Specified by:
      `preRegister` in interface `MBeanRegistration`

  - ### removeConnectionProperty

    public void removeConnectionProperty(String name)
    Removes a custom connection property.
    Parameters:
      `name` - Name of the custom connection property to remove
    See Also:
      - `addConnectionProperty(String, String)`

  - ### restart

    public void restart() throws SQLException
    Restarts the datasource.

    This method calls `close()` and `start()` in sequence within synchronized scope so any connection requests that come in while the datasource is shutting down will be served by the new pool.

    Idle connections that are stored in the connection pool when this method is invoked are closed, but connections that are checked out to clients when this method is invoked are not affected. When client applications subsequently invoke `Connection.close()` to return these connections to the pool, the underlying JDBC connections are closed. These connections do not count in `getMaxTotal()` or `getNumActive()` after invoking this method. For example, if there are 3 connections checked out by clients when `restart()` is invoked, after this method is called, `getNumActive()` will return 0 and up to `getMaxTotal()` + 3 connections may be open until the connections sourced from the original pool are returned.

    The new connection pool created by this method is initialized with currently set configuration properties.

    Specified by:
      `restart` in interface `DataSourceMXBean`
    Throws:
      `SQLException` - if an error occurs initializing the datasource

  - ### setAbandonedLogWriter

    public void setAbandonedLogWriter(PrintWriter logWriter)
    Sets the print writer to be used by this configuration to log information on abandoned objects.
    Parameters:
      `logWriter` - The new log writer

  - ### setAbandonedUsageTracking

    public void setAbandonedUsageTracking(boolean usageTracking)
    If the connection pool implements `UsageTracking`, configure whether the connection pool should record a stack trace every time a method is called on a pooled connection and retain the most recent stack trace to aid debugging of abandoned connections.
    Parameters:
      `usageTracking` - A value of `true` will enable the recording of a stack trace on every use of a pooled connection

  - ### setAccessToUnderlyingConnectionAllowed

    public void setAccessToUnderlyingConnectionAllowed(boolean allow)
    Sets the value of the accessToUnderlyingConnectionAllowed property. It controls if the PoolGuard allows access to the underlying connection. (Default: false)

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `allow` - Access to the underlying connection is granted when true.

  - ### setAutoCommitOnReturn

    public void setAutoCommitOnReturn(boolean autoCommitOnReturn)
    Sets the value of the flag that controls whether or not connections being returned to the pool will be checked and configured with `Connection.setAutoCommit(true)` if the auto commit setting is `false` when the connection is returned. It is `true` by default.
    Parameters:
      `autoCommitOnReturn` - Whether or not connections being returned to the pool will be checked and configured with auto-commit.
    Since:
      2.6.0

  - ### setCacheState

    public void setCacheState(boolean cacheState)
    Sets the state caching flag.
    Parameters:
      `cacheState` - The new value for the state caching flag

  - ### setClearStatementPoolOnReturn

    public void setClearStatementPoolOnReturn(boolean clearStatementPoolOnReturn)
    Sets whether the pool of statements (which was enabled with `setPoolPreparedStatements(boolean)`) should be cleared when the connection is returned to its pool. Default is false.
    Parameters:
      `clearStatementPoolOnReturn` - clear or not
    Since:
      2.8.0

  - ### setConnectionFactoryClassName

    public void setConnectionFactoryClassName(String connectionFactoryClassName)
    Sets the ConnectionFactory class name.
    Parameters:
      `connectionFactoryClassName` - A class name.
    Since:
      2.7.0

  - ### setConnectionInitSqls

    public void setConnectionInitSqls(Collection<String> connectionInitSqls)
    Sets the collection of SQL statements to be executed when a physical connection is first created.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `connectionInitSqls` - Collection of SQL statements to execute on connection creation

  - ### setConnectionInitSqls

    public void setConnectionInitSqls(List<String> connectionInitSqls)
    Sets the list of SQL statements to be executed when a physical connection is first created.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `connectionInitSqls` - List of SQL statements to execute on connection creation
    Since:
      2.12.0

  - ### setConnectionProperties

    public void setConnectionProperties(String connectionProperties)
    Sets the connection properties passed to driver.connect(...).

    Format of the string must be [propertyName=property;]*

    NOTE - The "user" and "password" properties will be added explicitly, so they do not need to be included here.

    Parameters:
      `connectionProperties` - the connection properties used to create new connections

  - ### setDefaultAutoCommit

    public void setDefaultAutoCommit(Boolean defaultAutoCommit)
    Sets default auto-commit state of connections returned by this datasource.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `defaultAutoCommit` - default auto-commit value

  - ### setDefaultCatalog

    public void setDefaultCatalog(String defaultCatalog)
    Sets the default catalog.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `defaultCatalog` - the default catalog

  - ### setDefaultQueryTimeout

    public void setDefaultQueryTimeout(Duration defaultQueryTimeoutDuration)
    Sets the default query timeout that will be used for `Statement`s created from this connection. `null` means that the driver default will be used.
    Parameters:
      `defaultQueryTimeoutDuration` - The default query timeout Duration.
    Since:
      2.10.0

  - ### setDefaultQueryTimeout

    @Deprecated public void setDefaultQueryTimeout(Integer defaultQueryTimeoutSeconds)
    Deprecated.
    Use `setDefaultQueryTimeout(Duration)`.
    Sets the default query timeout that will be used for `Statement`s created from this connection. `null` means that the driver default will be used.
    Parameters:
      `defaultQueryTimeoutSeconds` - The default query timeout in seconds.

  - ### setDefaultReadOnly

    public void setDefaultReadOnly(Boolean defaultReadOnly)
    Sets defaultReadonly property.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `defaultReadOnly` - default read-only value

  - ### setDefaultSchema

    public void setDefaultSchema(String defaultSchema)
    Sets the default schema.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `defaultSchema` - the default catalog
    Since:
      2.5.0

  - ### setDefaultTransactionIsolation

    public void setDefaultTransactionIsolation(int defaultTransactionIsolation)
    Sets the default transaction isolation state for returned connections.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `defaultTransactionIsolation` - the default transaction isolation state
    See Also:
      - `Connection.getTransactionIsolation()`

  - ### setDisconnectionIgnoreSqlCodes

    public void setDisconnectionIgnoreSqlCodes(Collection<String> disconnectionIgnoreSqlCodes)
    Sets the SQL State codes that should be ignored when determining fatal disconnection conditions.

    This method allows you to specify a collection of SQL State codes that will be excluded from disconnection checks. These codes will not trigger the "fatally disconnected" status even if they match the typical disconnection criteria. This can be useful in scenarios where certain SQL State codes (e.g., specific codes starting with "08") are known to be non-fatal in your environment.

    The effect of this method is similar to the one described in `setDisconnectionSqlCodes(Collection)`, but instead of setting codes that signal fatal disconnections, it defines codes that should be ignored during such checks.

    Note: This method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter`.

    Parameters:
      `disconnectionIgnoreSqlCodes` - SQL State codes that should be ignored in disconnection checks
    Throws:
      `IllegalArgumentException` - if any SQL state codes overlap with those in `disconnectionSqlCodes`.
    Since:
      2.13.0

  - ### setDisconnectionSqlCodes

    public void setDisconnectionSqlCodes(Collection<String> disconnectionSqlCodes)
    Sets the SQL State codes considered to signal fatal conditions.

    Overrides the defaults in `Utils.getDisconnectionSqlCodes()` (plus anything starting with `Utils.DISCONNECTION_SQL_CODE_PREFIX`). If this property is non-null and `getFastFailValidation()` is `true`, whenever connections created by this datasource generate exceptions with SQL State codes in this list, they will be marked as "fatally disconnected" and subsequent validations will fail fast (no attempt at isValid or validation query).

    If `getFastFailValidation()` is `false` setting this property has no effect.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter`.

    Parameters:
      `disconnectionSqlCodes` - SQL State codes considered to signal fatal conditions
    Throws:
      `IllegalArgumentException` - if any SQL state codes overlap with those in `disconnectionIgnoreSqlCodes`.
    Since:
      2.1

  - ### setDriver

    public void setDriver(Driver driver)
    Sets the JDBC Driver instance to use for this pool.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `driver` - The JDBC Driver instance to use for this pool.

  - ### setDriverClassLoader

    public void setDriverClassLoader(ClassLoader driverClassLoader)
    Sets the class loader to be used to load the JDBC driver.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `driverClassLoader` - the class loader with which to load the JDBC driver

  - ### setDriverClassName

    public void setDriverClassName(String driverClassName)
    Sets the JDBC driver class name.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `driverClassName` - the class name of the JDBC driver

  - ### setDurationBetweenEvictionRuns

    public void setDurationBetweenEvictionRuns(Duration timeBetweenEvictionRunsMillis)
    Sets the {code durationBetweenEvictionRuns} property.
    Parameters:
      `timeBetweenEvictionRunsMillis` - the new time between evictor runs
    Since:
      2.10.0
    See Also:
      - `setDurationBetweenEvictionRuns(Duration)`

  - ### setEnableAutoCommitOnReturn

    @Deprecated public void setEnableAutoCommitOnReturn(boolean autoCommitOnReturn)
    Deprecated.
    Use `setAutoCommitOnReturn(boolean)`.
    Sets the value of the flag that controls whether or not connections being returned to the pool will be checked and configured with `Connection.setAutoCommit(true)` if the auto commit setting is `false` when the connection is returned. It is `true` by default.
    Parameters:
      `autoCommitOnReturn` - Whether or not connections being returned to the pool will be checked and configured with auto-commit.

  - ### setEvictionPolicyClassName

    public void setEvictionPolicyClassName(String evictionPolicyClassName)
    Sets the EvictionPolicy implementation to use with this connection pool.
    Parameters:
      `evictionPolicyClassName` - The fully qualified class name of the EvictionPolicy implementation

  - ### setFastFailValidation

    public void setFastFailValidation(boolean fastFailValidation)
    Parameters:
      `fastFailValidation` - true means connections created by this factory will fast fail validation
    Since:
      2.1
    See Also:
      - `getFastFailValidation()`

  - ### setInitialSize

    public void setInitialSize(int initialSize)
    Sets the initial size of the connection pool.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `initialSize` - the number of connections created when the pool is initialized

  - ### setJmxName

    public void setJmxName(String jmxName)
    Sets the JMX name that has been requested for this DataSource. If the requested name is not valid, an alternative may be chosen. This DataSource will attempt to register itself using this name. If another component registers this DataSource with JMX and this name is valid this name will be used in preference to any specified by the other component.
    Parameters:
      `jmxName` - The JMX name that has been requested for this DataSource

  - ### setLifo

    public void setLifo(boolean lifo)
    Sets the LIFO property. True means the pool behaves as a LIFO queue; false means FIFO.
    Parameters:
      `lifo` - the new value for the LIFO property

  - ### setLogAbandoned

    public void setLogAbandoned(boolean logAbandoned)
    Parameters:
      `logAbandoned` - new logAbandoned property value

  - ### setLogExpiredConnections

    public void setLogExpiredConnections(boolean logExpiredConnections)
    When `getMaxConnDuration()` is set to limit connection lifetime, this property determines whether or not log messages are generated when the pool closes connections due to maximum lifetime exceeded. Set this property to false to suppress log messages when connections expire.
    Parameters:
      `logExpiredConnections` - Whether or not log messages are generated when the pool closes connections due to maximum lifetime exceeded.

  - ### setLoginTimeout

    public void setLoginTimeout(int loginTimeout) throws SQLException
    BasicDataSource does NOT support this method.

    Sets the login timeout (in seconds) for connecting to the database.

    Calls `createDataSource()`, so has the side effect of initializing the connection pool.

    Specified by:
      `setLoginTimeout` in interface `CommonDataSource`
    Parameters:
      `loginTimeout` - The new login timeout, or zero for no timeout
    Throws:
      `UnsupportedOperationException` - If the DataSource implementation does not support the login timeout feature.
      `SQLException` - if a database access error occurs

  - ### setLogWriter

    public void setLogWriter(PrintWriter logWriter) throws SQLException
    Sets the log writer being used by this data source.

    Calls `createDataSource()`, so has the side effect of initializing the connection pool.

    Specified by:
      `setLogWriter` in interface `CommonDataSource`
    Parameters:
      `logWriter` - The new log writer
    Throws:
      `SQLException` - if a database access error occurs

  - ### setMaxConn

    public void setMaxConn(Duration maxConnDuration)
    Sets the maximum permitted lifetime of a connection. A value of zero or less indicates an infinite lifetime.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `maxConnDuration` - The maximum permitted lifetime of a connection.
    Since:
      2.10.0

  - ### setMaxConnLifetimeMillis

    @Deprecated public void setMaxConnLifetimeMillis(long maxConnLifetimeMillis)
    Deprecated.
    Use `setMaxConn(Duration)`.
    Sets the maximum permitted lifetime of a connection in milliseconds. A value of zero or less indicates an infinite lifetime.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `maxConnLifetimeMillis` - The maximum permitted lifetime of a connection in milliseconds.

  - ### setMaxIdle

    public void setMaxIdle(int maxIdle)
    Sets the maximum number of connections that can remain idle in the pool. Excess idle connections are destroyed on return to the pool.
    Parameters:
      `maxIdle` - the new value for maxIdle
    See Also:
      - `getMaxIdle()`

  - ### setMaxOpenPreparedStatements

    public void setMaxOpenPreparedStatements(int maxOpenStatements)
    Sets the value of the `maxOpenPreparedStatements` property.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `maxOpenStatements` - the new maximum number of prepared statements

  - ### setMaxTotal

    public void setMaxTotal(int maxTotal)
    Sets the maximum total number of idle and borrows connections that can be active at the same time. Use a negative value for no limit.
    Parameters:
      `maxTotal` - the new value for maxTotal
    See Also:
      - `getMaxTotal()`

  - ### setMaxWait

    public void setMaxWait(Duration maxWaitDuration)
    Sets the MaxWaitMillis property. Use -1 to make the pool wait indefinitely.
    Parameters:
      `maxWaitDuration` - the new value for MaxWaitMillis
    Since:
      2.10.0
    See Also:
      - `getMaxWaitDuration()`

  - ### setMaxWaitMillis

    @Deprecated public void setMaxWaitMillis(long maxWaitMillis)
    Deprecated.
    `setMaxWait(Duration)`.
    Sets the MaxWaitMillis property. Use -1 to make the pool wait indefinitely.
    Parameters:
      `maxWaitMillis` - the new value for MaxWaitMillis
    See Also:
      - `getMaxWaitDuration()`

  - ### setMinEvictableIdle

    public void setMinEvictableIdle(Duration minEvictableIdleDuration)
    Sets the {code minEvictableIdleDuration} property.
    Parameters:
      `minEvictableIdleDuration` - the minimum amount of time an object may sit idle in the pool
    Since:
      2.10.0
    See Also:
      - `setMinEvictableIdle(Duration)`

  - ### setMinEvictableIdleTimeMillis

    @Deprecated public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
    Deprecated.
    Use `setMinEvictableIdle(Duration)`.
    Sets the {code minEvictableIdleDuration} property.
    Parameters:
      `minEvictableIdleTimeMillis` - the minimum amount of time an object may sit idle in the pool
    See Also:
      - `setMinEvictableIdle(Duration)`

  - ### setMinIdle

    public void setMinIdle(int minIdle)
    Sets the minimum number of idle connections in the pool. The pool attempts to ensure that minIdle connections are available when the idle object evictor runs. The value of this property has no effect unless {code durationBetweenEvictionRuns} has a positive value.
    Parameters:
      `minIdle` - the new value for minIdle
    See Also:
      - `GenericObjectPool.setMinIdle(int)`

  - ### setNumTestsPerEvictionRun

    public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
    Sets the value of the {code numTestsPerEvictionRun} property.
    Parameters:
      `numTestsPerEvictionRun` - the new {code numTestsPerEvictionRun} value
    See Also:
      - `setNumTestsPerEvictionRun(int)`

  - ### setPassword

    public void setPassword(String password)
    Sets the {code password}.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `password` - new value for the password

  - ### setPoolPreparedStatements

    public void setPoolPreparedStatements(boolean poolingStatements)
    Sets whether to pool statements or not.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `poolingStatements` - pooling on or off

  - ### setRegisterConnectionMBean

    public void setRegisterConnectionMBean(boolean registerConnectionMBean)
    Sets if connection level JMX tracking is requested for this DataSource. If true, each connection will be registered for tracking with JMX.
    Parameters:
      `registerConnectionMBean` - connection tracking requested for this DataSource.

  - ### setRemoveAbandonedOnBorrow

    public void setRemoveAbandonedOnBorrow(boolean removeAbandonedOnBorrow)
    Parameters:
      `removeAbandonedOnBorrow` - true means abandoned connections may be removed when connections are borrowed from the pool.
    See Also:
      - `getRemoveAbandonedOnBorrow()`

  - ### setRemoveAbandonedOnMaintenance

    public void setRemoveAbandonedOnMaintenance(boolean removeAbandonedOnMaintenance)
    Parameters:
      `removeAbandonedOnMaintenance` - true means abandoned connections may be removed on pool maintenance.
    See Also:
      - `getRemoveAbandonedOnMaintenance()`

  - ### setRemoveAbandonedTimeout

    public void setRemoveAbandonedTimeout(Duration removeAbandonedTimeout)
    Sets the timeout before an abandoned connection can be removed.

    Setting this property has no effect if `getRemoveAbandonedOnBorrow()` and {code getRemoveAbandonedOnMaintenance()} are false.

    Parameters:
      `removeAbandonedTimeout` - new abandoned timeout
    Since:
      2.10.0
    See Also:
      - `getRemoveAbandonedTimeoutDuration()`
      - `getRemoveAbandonedOnBorrow()`
      - `getRemoveAbandonedOnMaintenance()`

  - ### setRemoveAbandonedTimeout

    @Deprecated public void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
    Deprecated.
    Use `setRemoveAbandonedTimeout(Duration)`.
    Sets the timeout in seconds before an abandoned connection can be removed.

    Setting this property has no effect if `getRemoveAbandonedOnBorrow()` and `getRemoveAbandonedOnMaintenance()` are false.

    Parameters:
      `removeAbandonedTimeout` - new abandoned timeout in seconds
    See Also:
      - `getRemoveAbandonedTimeoutDuration()`
      - `getRemoveAbandonedOnBorrow()`
      - `getRemoveAbandonedOnMaintenance()`

  - ### setRollbackOnReturn

    public void setRollbackOnReturn(boolean rollbackOnReturn)
    Sets the flag that controls if a connection will be rolled back when it is returned to the pool if auto commit is not enabled and the connection is not read only.
    Parameters:
      `rollbackOnReturn` - whether a connection will be rolled back when it is returned to the pool.

  - ### setSoftMinEvictableIdle

    public void setSoftMinEvictableIdle(Duration softMinEvictableIdleTimeMillis)
    Sets the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.
    Parameters:
      `softMinEvictableIdleTimeMillis` - minimum amount of time a connection may sit idle in the pool before it is eligible for eviction, assuming there are minIdle idle connections in the pool.
    Since:
      2.10.0
    See Also:
      - `getSoftMinEvictableIdleTimeMillis()`

  - ### setSoftMinEvictableIdleTimeMillis

    @Deprecated public void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis)
    Deprecated.
    Use `setSoftMinEvictableIdle(Duration)`.
    Sets the minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle object evictor, with the extra condition that at least "minIdle" connections remain in the pool.
    Parameters:
      `softMinEvictableIdleTimeMillis` - minimum amount of time a connection may sit idle in the pool before it is eligible for eviction, assuming there are minIdle idle connections in the pool.
    See Also:
      - `getSoftMinEvictableIdleTimeMillis()`

  - ### setTestOnBorrow

    public void setTestOnBorrow(boolean testOnBorrow)
    Sets the {code testOnBorrow} property. This property determines whether or not the pool will validate objects before they are borrowed from the pool.
    Parameters:
      `testOnBorrow` - new value for testOnBorrow property

  - ### setTestOnCreate

    public void setTestOnCreate(boolean testOnCreate)
    Sets the {code testOnCreate} property. This property determines whether or not the pool will validate objects immediately after they are created by the pool
    Parameters:
      `testOnCreate` - new value for testOnCreate property

  - ### setTestOnReturn

    public void setTestOnReturn(boolean testOnReturn)
    Sets the `testOnReturn` property. This property determines whether or not the pool will validate objects before they are returned to the pool.
    Parameters:
      `testOnReturn` - new value for testOnReturn property

  - ### setTestWhileIdle

    public void setTestWhileIdle(boolean testWhileIdle)
    Sets the `testWhileIdle` property. This property determines whether or not the idle object evictor will validate connections.
    Parameters:
      `testWhileIdle` - new value for testWhileIdle property

  - ### setTimeBetweenEvictionRunsMillis

    @Deprecated public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
    Deprecated.
    Use `setDurationBetweenEvictionRuns(Duration)`.
    Sets the {code durationBetweenEvictionRuns} property.
    Parameters:
      `timeBetweenEvictionRunsMillis` - the new time between evictor runs
    See Also:
      - `setDurationBetweenEvictionRuns(Duration)`

  - ### setUrl

    public void setUrl(String connectionString)
    Sets the {code connection string}.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `connectionString` - the new value for the JDBC connection connectionString

  - ### setUsername

    public void setUsername(String userName)
    Sets the {code userName}.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `userName` - the new value for the JDBC connection user name

  - ### setValidationQuery

    public void setValidationQuery(String validationQuery)
    Sets the {code validationQuery}.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `validationQuery` - the new value for the validation query

  - ### setValidationQueryTimeout

    public void setValidationQueryTimeout(Duration validationQueryTimeoutDuration)
    Sets the validation query timeout, the amount of time, in seconds, that connection validation will wait for a response from the database when executing a validation query. Use a value less than or equal to 0 for no timeout.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `validationQueryTimeoutDuration` - new validation query timeout value in seconds
    Since:
      2.10.0

  - ### setValidationQueryTimeout

    @Deprecated public void setValidationQueryTimeout(int validationQueryTimeoutSeconds)
    Deprecated.
    Use `setValidationQueryTimeout(Duration)`.
    Sets the validation query timeout, the amount of time, in seconds, that connection validation will wait for a response from the database when executing a validation query. Use a value less than or equal to 0 for no timeout.

    Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: `getConnection()`, `setLogWriter(PrintWriter)`, `setLoginTimeout(int)`, `getLoginTimeout()`, `getLogWriter()`.

    Parameters:
      `validationQueryTimeoutSeconds` - new validation query timeout value in seconds

  - ### start

    public void start() throws SQLException
    Starts the datasource.

    It is not necessary to call this method before using a newly created BasicDataSource instance, but calling it in that context causes the datasource to be immediately initialized (instead of waiting for the first `getConnection()` request). Its primary use is to restart and reinitialize a datasource that has been closed.

    When this method is called after `close()`, connections checked out by clients before the datasource was stopped do not count in `getMaxTotal()` or `getNumActive()`. For example, if there are 3 connections checked out by clients when `close()` is invoked and they are not returned before `start()` is invoked, after this method is called, `getNumActive()` will return 0. These connections will be physically closed when they are returned, but they will not count against the maximum allowed in the newly started datasource.

    Specified by:
      `start` in interface `DataSourceMXBean`
    Throws:
      `SQLException` - if an error occurs initializing the datasource

  - ### startPoolMaintenance

    protected void startPoolMaintenance()
    Starts the connection pool maintenance task, if configured.

  - ### unwrap

    public <T> T unwrap(Class<T> iface) throws SQLException
    Specified by:
      `unwrap` in interface `Wrapper`
    Throws:
      `SQLException`