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 DatabaseSettings
clone()
static DatabaseSettings
create(DatabasePropertiesFile databasePropertiesFile, boolean allowNewOne)
Properties
getConnectionProperties()
String
getConnectionString()
DatabaseType
getDatabaseType()
boolean
getDefaultAutoCommit()
Returns the value of thedefaultAutoCommit
property.String
getDriverName()
String
getIndexTablespace()
int
getInitialConnections()
JdbcConnectionString
getJdbcConnectionString()
String
getLogin()
int
getMaxConnections()
int
getMaxIdleConnections()
long
getTimeBetweenEvictionRunsMillis()
Returns the value of thetimeBetweenEvictionRunsMillis
property.int
getTransactionIsolation()
String
getValidationQuery()
void
initializeFromProperties(Properties properties)
boolean
isAutoCommitOnReturn()
boolean
isPoolPreparedStatements()
boolean
isRollbackOnReturn()
boolean
isTestOnBorrow()
Returns thetestOnBorrow
property.boolean
isTestOnReturn()
Returns the value of thetestOnReturn
property.boolean
isTestWhileIdle()
Returns the value of thetestWhileIdle
property.void
setAutoCommitOnReturn(boolean autoCommitOnReturn)
void
setConnectingAttemptsInterval(long connectingAttemptsInterval)
Deprecated.void
setConnectingTimeout(long connectingTimeout)
Deprecated.void
setConnectionProperties(Properties connectionProperties)
void
setConnectionUrl(String connectionUrl)
$TEAMCITY_SYSTEM_PATH pattern in the connection url will be replaced with value of the systemDir argument passed to this constructor.void
setDatabaseType(DatabaseType databaseType)
void
setDefaultAutoCommit(boolean defaultAutoCommit)
Sets thedefaultAutoCommit
property.void
setDriverName(String driverName)
void
setIndexTablespace(String indexTablespace)
void
setInitialConnections(int initialConnections)
void
setMaxConnections(int maxConnections)
void
setMaxIdleConnections(int maxIdleConnections)
void
setPoolPreparedStatements(boolean poolPreparedStatements)
void
setRollbackOnReturn(boolean rollbackOnReturn)
void
setTestOnBorrow(boolean testOnBorrow)
Sets thetestOnBorrow
property.void
setTestOnReturn(boolean testOnReturn)
Sets thetestOnReturn
property.void
setTestWhileIdle(boolean testWhileIdle)
Sets thetestWhileIdle
property.void
setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
Sets thetimeBetweenEvictionRunsMillis
property.void
setTransactionIsolation(int transactionIsolation)
void
setValidationQuery(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
testOnBorrow
property.- Returns:
true
if objects are validated before being borrowed from the pool.- See Also:
myTestOnBorrow
,BasicDataSource.getTestOnBorrow()
-
setTestOnBorrow
public void setTestOnBorrow(boolean testOnBorrow)
Sets the
testOnBorrow
property. This property determines whether or not the pool will validate objects before they are borrowed from the pool. For atrue
value to have any effect, thevalidationQuery
property must be set to a non-null
string.- Parameters:
testOnBorrow
- new value fortestOnBorrow
property.- See Also:
BasicDataSource.setTestOnBorrow(boolean)
-
isTestOnReturn
public boolean isTestOnReturn()
Returns the value of the
testOnReturn
property.- Returns:
true
if 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
testOnReturn
property. This property determines whether or not the pool will validate objects before they are returned to the pool. For atrue
value to have any effect, thevalidationQuery
property must be set to a non-null
string.- Parameters:
testOnReturn
- new value fortestOnReturn
property.- Since:
- 10.0.3
- See Also:
BasicDataSource.setTestOnReturn(boolean)
-
isTestWhileIdle
public boolean isTestWhileIdle()
Returns the value of the
testWhileIdle
property.- Returns:
true
if 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
testWhileIdle
property. This property determines whether or not the idle object evictor will validate connections. For atrue
value to have any effect, thevalidationQuery
property must be set to a non-null
string.- Parameters:
testWhileIdle
- new value fortestWhileIdle
property.- Since:
- 10.0.3
- See Also:
BasicDataSource.setTestWhileIdle(boolean)
-
getTimeBetweenEvictionRunsMillis
public long getTimeBetweenEvictionRunsMillis()
Returns the value of the
timeBetweenEvictionRunsMillis
property.- 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
timeBetweenEvictionRunsMillis
property.- 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
defaultAutoCommit
property.- 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
defaultAutoCommit
property.- 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()
-
-