Class 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 Detail

      • 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()
      • getConnectionString

        @NotNull
        public String getConnectionString()
      • 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 a true value to have any effect, the validationQuery property must be set to a non-null string.

        Parameters:
        testOnBorrow - new value for testOnBorrow 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 a true value to have any effect, the validationQuery property must be set to a non-null string.

        Parameters:
        testOnReturn - new value for testOnReturn 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 a true value to have any effect, the validationQuery property must be set to a non-null string.

        Parameters:
        testWhileIdle - new value for testWhileIdle 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 -