- All Superinterfaces:
DataSourceBuilder
- All Known Implementing Classes:
DataSourceConfig
- Enclosing interface:
DataSourceBuilder
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.ebean.datasource.DataSourceBuilder
DataSourceBuilder.Settings -
Method Summary
Modifier and TypeMethodDescriptioncatalog()Return the database catalog.Return the connection properties including credentials and custom parameters.Return a DataSource that will be used to provide new connections or null.driver()Return the driver instance to use.Return the driver class to use (if an instance is not provided).default StringReturn the database driver className to use (if an driver instance or class is not provided).getAlert()Return the alert implementation to use.Return the clientInfo ApplicationName property.Return the clientInfo ApplicationName property.intReturn the size of the CallableStatement cache (per connection).Return a map of custom properties for the jdbc driver connection.Deprecated, for removal: This API element is subject to removal in a future version.intReturn the heartbeat frequency in seconds.intReturn the number, how often the heartbeat has to detect pool exhaustion in succession.Return a SQL statement used to test the database is accessible.intReturn the heart beat timeout in seconds.Return the InitDatabase to use with ownerUsername.intReturn the number of initial connections to create on startup.Return a list of init queries, that are executed after a connection is opened.intReturn the transaction isolation level.intReturn the time in minutes after which a connection could be considered to have leaked.Return the listener to use.intReturn the maximum age a connection is allowed to be before it is closed.intReturn the maximum number of connections the pool can reach.intReturn the time in seconds a connection can be idle after which it can be trimmed from the pool.intReturn the max size for reporting stack traces on busy connections.intReturn the minimum number of connections the pool should maintain.Return the database owner password.Return the database owner username.Return the database password.Return the database alternate password2.Return the database platform.Return the pool listener.intReturn the size of the PreparedStatement cache (per connection).Return the read-only URL to use for creating a matching read only DataSource.Return the database username.intReturn the minimum time gap between pool trim checks.getUrl()Return the connection URL.Return the database username.intReturn the time in millis to wait for a connection before timing out once the pool has reached its maximum size.booleanReturn autoCommit setting.booleanReturn true if a stack trace should be captured when obtaining a connection from the pool.booleanisEmpty()Return true if there are no values set for any of url, username, password or driver.booleanReturn true (default) if the DataSource should be fail on start.booleanReturn true if the DataSource should be left offline.booleanReturn the read only setting.booleanShut down pool on JVM exit.booleanWhen true validate the pool when the heartbeat runs.booleanReturn true if InitDatabase should be used (when the pool initialises and a connection can't be obtained).Methods inherited from interface io.ebean.datasource.DataSourceBuilder
addProperty, addProperty, addProperty, alert, alsoIf, applicationName, apply, autoCommit, build, captureStackTrace, catalog, clientInfo, copy, cstmtCacheSize, customProperties, dataSource, driver, driver, driver, enforceCleanClose, enforceCleanClose, failOnStart, heartbeatFreqSecs, heartbeatMaxPoolExhaustedCount, heartbeatSql, heartbeatTimeoutSeconds, initDatabase, initDatabaseForPlatform, initialConnections, initSql, isolationLevel, leakTimeMinutes, listener, load, load, loadSettings, maxAgeMinutes, maxConnections, maxInactiveTimeSecs, maxStackTraceSize, minConnections, name, offline, ownerPassword, ownerUsername, password, password2, platform, poolListener, pstmtCacheSize, readOnly, readOnlyUrl, schema, setAlert, setApplicationName, setAutoCommit, setCaptureStackTrace, setClientInfo, setCstmtCacheSize, setCustomProperties, setDefaults, setDriver, setFailOnStart, setHeartbeatFreqSecs, setHeartbeatSql, setHeartbeatTimeoutSeconds, setInitDatabase, setInitDatabaseForPlatform, setInitSql, setIsolationLevel, setLeakTimeMinutes, setListener, setMaxAgeMinutes, setMaxConnections, setMaxInactiveTimeSecs, setMaxStackTraceSize, setMinConnections, setName, setOffline, setOwnerPassword, setOwnerUsername, setPassword, setPassword2, setPlatform, setPoolListener, setPstmtCacheSize, setReadOnly, setReadOnlyUrl, setSchema, settings, setTrimPoolFreqSecs, setUrl, setUsername, setWaitTimeoutMillis, shutdownOnJvmExit, trimPoolFreqSecs, url, username, validateOnHeartbeat, waitTimeoutMillis
-
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
Return the driver class to use (if an instance is not provided). -
driverClassName
Return the database driver className to use (if an driver instance or class is not provided). -
getDriver
Deprecated, for removal: This API element is subject to removal in a future version.migrate todriverClassName(). -
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
Return a map of custom properties for the jdbc driver connection. -
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.
-
driverClassName().