Class DatabaseSettings
- java.lang.Object
-
- jetbrains.buildServer.serverSide.db.DatabaseSettings
-
- All Implemented Interfaces:
Cloneable
public final class DatabaseSettings extends Object implements Cloneable
Contains JDBC settings to be used for new connections creation: driver name, connection url and connection properties. Connection URL can optionally contain pattern $TEAMCITY_SYSTEM_PATH which will be replaced with current user's home directory path.- Author:
- Pavel Sher
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected DatabaseSettingsclone()static DatabaseSettingscreate(DatabasePropertiesFile databasePropertiesFile, boolean allowNewOne)PropertiesgetConnectionProperties()StringgetConnectionString()DatabaseTypegetDatabaseType()booleangetDefaultAutoCommit()Returns the value of thedefaultAutoCommitproperty.StringgetDriverName()StringgetIndexTablespace()intgetInitialConnections()JdbcConnectionStringgetJdbcConnectionString()StringgetLogin()intgetMaxConnections()intgetMaxIdleConnections()longgetTimeBetweenEvictionRunsMillis()Returns the value of thetimeBetweenEvictionRunsMillisproperty.intgetTransactionIsolation()StringgetValidationQuery()voidinitializeFromProperties(Properties properties)booleanisAutoCommitOnReturn()booleanisPoolPreparedStatements()booleanisRollbackOnReturn()booleanisTestOnBorrow()Returns thetestOnBorrowproperty.booleanisTestOnReturn()Returns the value of thetestOnReturnproperty.booleanisTestWhileIdle()Returns the value of thetestWhileIdleproperty.voidsetAutoCommitOnReturn(boolean autoCommitOnReturn)voidsetConnectingAttemptsInterval(long connectingAttemptsInterval)Deprecated.voidsetConnectingTimeout(long connectingTimeout)Deprecated.voidsetConnectionProperties(Properties connectionProperties)voidsetConnectionUrl(String connectionUrl)$TEAMCITY_SYSTEM_PATH pattern in the connection url will be replaced with value of the systemDir argument passed to this constructor.voidsetDatabaseType(DatabaseType databaseType)voidsetDefaultAutoCommit(boolean defaultAutoCommit)Sets thedefaultAutoCommitproperty.voidsetDriverName(String driverName)voidsetIndexTablespace(String indexTablespace)voidsetInitialConnections(int initialConnections)voidsetMaxConnections(int maxConnections)voidsetMaxIdleConnections(int maxIdleConnections)voidsetPoolPreparedStatements(boolean poolPreparedStatements)voidsetRollbackOnReturn(boolean rollbackOnReturn)voidsetTestOnBorrow(boolean testOnBorrow)Sets thetestOnBorrowproperty.voidsetTestOnReturn(boolean testOnReturn)Sets thetestOnReturnproperty.voidsetTestWhileIdle(boolean testWhileIdle)Sets thetestWhileIdleproperty.voidsetTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)Sets thetimeBetweenEvictionRunsMillisproperty.voidsetTransactionIsolation(int transactionIsolation)voidsetValidationQuery(String validationQuery)
-
-
-
Method Detail
-
create
@NotNull public static DatabaseSettings create(@NotNull DatabasePropertiesFile databasePropertiesFile, boolean allowNewOne)
-
setDriverName
public void setDriverName(@Nullable String driverName)
-
setConnectionUrl
public void setConnectionUrl(@NotNull String connectionUrl) throws UnknownDatabaseTypeException$TEAMCITY_SYSTEM_PATH pattern in the connection url will be replaced with value of the systemDir argument passed to this constructor.- Parameters:
connectionUrl- can contain $TEAMCITY_SYSTEM_PATH pattern- Throws:
UnknownDatabaseTypeException- when could not determine the database type
-
setDatabaseType
public void setDatabaseType(DatabaseType databaseType)
-
isPoolPreparedStatements
public boolean isPoolPreparedStatements()
-
setPoolPreparedStatements
public void setPoolPreparedStatements(boolean poolPreparedStatements)
-
setConnectionProperties
public void setConnectionProperties(@NotNull Properties connectionProperties)
-
getDriverName
@Nullable public String getDriverName()
-
getDatabaseType
public DatabaseType getDatabaseType()
-
getConnectionString
@NotNull public String getConnectionString()
-
getJdbcConnectionString
@NotNull public JdbcConnectionString getJdbcConnectionString()
-
getConnectionProperties
@NotNull public Properties getConnectionProperties()
-
getLogin
public String getLogin()
-
getMaxConnections
public int getMaxConnections()
-
setMaxConnections
public void setMaxConnections(int maxConnections)
-
setInitialConnections
public void setInitialConnections(int initialConnections)
-
getInitialConnections
public int getInitialConnections()
-
getMaxIdleConnections
public int getMaxIdleConnections()
-
setMaxIdleConnections
public void setMaxIdleConnections(int maxIdleConnections)
-
isTestOnBorrow
public boolean isTestOnBorrow()
Returns the
testOnBorrowproperty.- Returns:
trueif objects are validated before being borrowed from the pool.- See Also:
myTestOnBorrow,BasicDataSource.getTestOnBorrow()
-
setTestOnBorrow
public void setTestOnBorrow(boolean testOnBorrow)
Sets the
testOnBorrowproperty. This property determines whether or not the pool will validate objects before they are borrowed from the pool. For atruevalue to have any effect, thevalidationQueryproperty must be set to a non-nullstring.- Parameters:
testOnBorrow- new value fortestOnBorrowproperty.- See Also:
BasicDataSource.setTestOnBorrow(boolean)
-
isTestOnReturn
public boolean isTestOnReturn()
Returns the value of the
testOnReturnproperty.- Returns:
trueif objects are validated before being returned to the pool.- Since:
- 10.0.3
- See Also:
myTestOnReturn,BasicDataSource.getTestOnReturn()
-
setTestOnReturn
public void setTestOnReturn(boolean testOnReturn)
Sets the
testOnReturnproperty. This property determines whether or not the pool will validate objects before they are returned to the pool. For atruevalue to have any effect, thevalidationQueryproperty must be set to a non-nullstring.- Parameters:
testOnReturn- new value fortestOnReturnproperty.- Since:
- 10.0.3
- See Also:
BasicDataSource.setTestOnReturn(boolean)
-
isTestWhileIdle
public boolean isTestWhileIdle()
Returns the value of the
testWhileIdleproperty.- Returns:
trueif objects examined by the idle object evictor are validated.- Since:
- 10.0.3
- See Also:
myTestWhileIdle,BasicDataSource.getTestWhileIdle()
-
setTestWhileIdle
public void setTestWhileIdle(boolean testWhileIdle)
Sets the
testWhileIdleproperty. This property determines whether or not the idle object evictor will validate connections. For atruevalue to have any effect, thevalidationQueryproperty must be set to a non-nullstring.- Parameters:
testWhileIdle- new value fortestWhileIdleproperty.- Since:
- 10.0.3
- See Also:
BasicDataSource.setTestWhileIdle(boolean)
-
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis()
Returns the value of the
timeBetweenEvictionRunsMillisproperty.- Returns:
- the time (in milliseconds) between evictor runs.
- Since:
- 10.0.3
- See Also:
myTimeBetweenEvictionRunsMillis,BasicDataSource.getTimeBetweenEvictionRunsMillis()
-
setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
Sets the
timeBetweenEvictionRunsMillisproperty.- Parameters:
timeBetweenEvictionRunsMillis- the new time between evictor runs.- Since:
- 10.0.3
- See Also:
myTimeBetweenEvictionRunsMillis,BasicDataSource.setTimeBetweenEvictionRunsMillis(long)
-
getDefaultAutoCommit
public boolean getDefaultAutoCommit()
Returns the value of the
defaultAutoCommitproperty.- Returns:
- the default auto-commit state of connections created by the pool.
- Since:
- 2017.2.5, 2018.1.1
- See Also:
myDefaultAutoCommit,BasicDataSource.getDefaultAutoCommit(),PoolConfiguration#getDefaultAutoCommit()
-
setDefaultAutoCommit
public void setDefaultAutoCommit(boolean defaultAutoCommit)
Sets the
defaultAutoCommitproperty.- Parameters:
defaultAutoCommit- the new default auto-commit state of connections created by the pool.- Since:
- 2017.2.5, 2018.1.1
- See Also:
myDefaultAutoCommit,BasicDataSource#setDefaultAutoCommit(boolean),PoolConfiguration#setDefaultAutoCommit(Boolean)
-
isAutoCommitOnReturn
public boolean isAutoCommitOnReturn()
-
setAutoCommitOnReturn
public void setAutoCommitOnReturn(boolean autoCommitOnReturn)
- Since:
- 2022.12
- See Also:
BasicDataSource.setAutoCommitOnReturn(boolean)
-
isRollbackOnReturn
public boolean isRollbackOnReturn()
-
setRollbackOnReturn
public void setRollbackOnReturn(boolean rollbackOnReturn)
- Since:
- 2022.12
- See Also:
BasicDataSource.setRollbackOnReturn(boolean)
-
getValidationQuery
@Nullable public String getValidationQuery()
-
setValidationQuery
public void setValidationQuery(@Nullable String validationQuery)
-
getTransactionIsolation
public int getTransactionIsolation()
-
setTransactionIsolation
public void setTransactionIsolation(int transactionIsolation)
-
getIndexTablespace
public String getIndexTablespace()
-
setIndexTablespace
public void setIndexTablespace(String indexTablespace)
-
setConnectingTimeout
@Deprecated public void setConnectingTimeout(long connectingTimeout)
Deprecated.This method really does nothing. To drop it in 9.0.- Parameters:
connectingTimeout-
-
setConnectingAttemptsInterval
@Deprecated public void setConnectingAttemptsInterval(long connectingAttemptsInterval)
Deprecated.This method really does nothing. To drop it in 9.0.- Parameters:
connectingAttemptsInterval-
-
initializeFromProperties
public void initializeFromProperties(@NotNull Properties properties) throws DBException- Throws:
DBException
-
clone
@NotNull protected DatabaseSettings clone()
-
-