Interface DataSourceBuilder.Settings

All Superinterfaces:
DataSourceBuilder
All Known Implementing Classes:
DataSourceConfig
Enclosing interface:
DataSourceBuilder

public static interface DataSourceBuilder.Settings extends DataSourceBuilder
The settings of the DataSourceBuilder. Provides getters/accessors to read the configured properties of this DataSourceBuilder.
  • Method Details

    • isEmpty

      boolean isEmpty()
      Return true if there are no values set for any of url, username, password or driver.
    • dataSource

      DataSource dataSource()
      Return a DataSource that will be used to provide new connections or null.
    • isShutdownOnJvmExit

      boolean isShutdownOnJvmExit()
      Shut down pool on JVM exit.
    • isValidateOnHeartbeat

      boolean isValidateOnHeartbeat()
      When true validate the pool when the heartbeat runs.
    • connectionProperties

      Properties connectionProperties()
      Return the connection properties including credentials and custom parameters.
    • getApplicationName

      String getApplicationName()
      Return the clientInfo ApplicationName property.
    • getClientInfo

      Properties getClientInfo()
      Return the clientInfo ApplicationName property.
    • getReadOnlyUrl

      String getReadOnlyUrl()
      Return the read-only URL to use for creating a matching read only DataSource.
    • getMaxAgeMinutes

      int getMaxAgeMinutes()
      Return the maximum age a connection is allowed to be before it is closed.

      This can be used to close old connections.

    • getUrl

      String getUrl()
      Return the connection URL.
    • getUsername

      String getUsername()
      Return the database username.
    • getPassword

      String getPassword()
      Return the database password.
    • getPassword2

      String getPassword2()
      Return the database alternate password2.
    • getSchema

      String getSchema()
      Return the database username.
    • catalog

      String catalog()
      Return the database catalog.
    • driver

      Driver driver()
      Return the driver instance to use.
    • driverClass

      Class<? extends Driver> driverClass()
      Return the driver class to use (if an instance is not provided).
    • driverClassName

      default String driverClassName()
      Return the database driver className to use (if an driver instance or class is not provided).
    • getDriver

      @Deprecated(forRemoval=true) String getDriver()
      Deprecated, for removal: This API element is subject to removal in a future version.
      migrate to driverClassName().
    • getIsolationLevel

      int getIsolationLevel()
      Return the transaction isolation level.
    • isAutoCommit

      boolean isAutoCommit()
      Return autoCommit setting.
    • isReadOnly

      boolean isReadOnly()
      Return the read only setting.
    • getMinConnections

      int getMinConnections()
      Return the minimum number of connections the pool should maintain. Defaults to 2.
    • getMaxConnections

      int getMaxConnections()
      Return the maximum number of connections the pool can reach. Defaults to 200.
    • getInitialConnections

      int getInitialConnections()
      Return the number of initial connections to create on startup.
    • getAlert

      DataSourceAlert getAlert()
      Return the alert implementation to use.
    • getListener

      DataSourcePoolListener getListener()
      Return the listener to use.
    • getHeartbeatSql

      String getHeartbeatSql()
      Return a SQL statement used to test the database is accessible.

      Note that if this is not set then it can get defaulted from the DatabasePlatform.

    • getHeartbeatFreqSecs

      int getHeartbeatFreqSecs()
      Return the heartbeat frequency in seconds.

      This is the expected frequency in which the DataSource should be checked to make sure it is healthy and trim idle connections.

    • getHeartbeatTimeoutSeconds

      int getHeartbeatTimeoutSeconds()
      Return the heart beat timeout in seconds.
    • getHeartbeatMaxPoolExhaustedCount

      int getHeartbeatMaxPoolExhaustedCount()
      Return the number, how often the heartbeat has to detect pool exhaustion in succession.
    • isCaptureStackTrace

      boolean isCaptureStackTrace()
      Return true if a stack trace should be captured when obtaining a connection from the pool.

      This can be used to diagnose a suspected connection pool leak.

      Obviously this has a performance overhead.

    • getMaxStackTraceSize

      int getMaxStackTraceSize()
      Return the max size for reporting stack traces on busy connections.
    • getLeakTimeMinutes

      int getLeakTimeMinutes()
      Return the time in minutes after which a connection could be considered to have leaked.
    • getPstmtCacheSize

      int getPstmtCacheSize()
      Return the size of the PreparedStatement cache (per connection).
    • getCstmtCacheSize

      int getCstmtCacheSize()
      Return the size of the CallableStatement cache (per connection).
    • getWaitTimeoutMillis

      int getWaitTimeoutMillis()
      Return the time in millis to wait for a connection before timing out once the pool has reached its maximum size.
    • getMaxInactiveTimeSecs

      int getMaxInactiveTimeSecs()
      Return the time in seconds a connection can be idle after which it can be trimmed from the pool.

      This is so that the pool after a busy period can trend over time back towards the minimum connections.

    • isFailOnStart

      boolean isFailOnStart()
      Return true (default) if the DataSource should be fail on start.

      If this is disabled, it allows to create a connection pool, even if the datasource is not available. (e.g. parallel start up of docker containers). It enables to initialize the Ebean-Server if the db-server is not yet up. In this case, a (DataSourceAlert.dataSourceUp(javax.sql.DataSource) is fired when DS gets up either immediately at start-up or later.)

    • getTrimPoolFreqSecs

      int getTrimPoolFreqSecs()
      Return the minimum time gap between pool trim checks.

      This defaults to 59 seconds meaning that the pool trim check will run every minute assuming the heart beat check runs every 30 seconds.

    • getPoolListener

      String getPoolListener()
      Return the pool listener.
    • isOffline

      boolean isOffline()
      Return true if the DataSource should be left offline.

      This is to support DDL generation etc without having a real database.

    • getCustomProperties

      Map<String,String> getCustomProperties()
      Return a map of custom properties for the jdbc driver connection.
    • getInitSql

      List<String> getInitSql()
      Return a list of init queries, that are executed after a connection is opened.
    • getOwnerUsername

      String getOwnerUsername()
      Return the database owner username.
    • getOwnerPassword

      String getOwnerPassword()
      Return the database owner password.
    • getPlatform

      String getPlatform()
      Return the database platform.
    • getInitDatabase

      InitDatabase getInitDatabase()
      Return the InitDatabase to use with ownerUsername.
    • useInitDatabase

      boolean useInitDatabase()
      Return true if InitDatabase should be used (when the pool initialises and a connection can't be obtained).
      Returns:
      True to obtain a connection using ownerUsername and run InitDatabase.