Icon

You are viewing the documentation of TeamCity 9.x, which is not the most recently released version of TeamCity.
View this page in the latest documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

 

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Configure the external database to be used by TeamCity (see the database-specific sections below).
  2. Run the TeamCity server for the first time.
  3. Select an external database to be used and specify the database connection settings.
    If required, you can later manually modify your database connection settings.
    (warning) Note that TeamCity creates its own database schema on the first start and actively modifies it during the upgrade. The schema is not changed when TeamCity is working normally.
    The user account used by TeamCity should have permissions to create new, modify and delete existing tables in its schema, in addition to usual read/write permissions on all tables.
  4. You may also need to download the JDBC driver for your database.
    Anchor
    database_driver
    database_driver
    Anchor
    Database Driver Installation
    Database Driver Installation
    Due to licensing terms, TeamCity does not bundle driver jars for external databases. You will need to download the Java JDBC driver and put the appropriate .jar files (see driver-specific sections below) from it into the <TeamCity Data Directory>/lib/jdbc directory.
    Please note that the .jar files should be compiled for the Java version not greater than the one used to run TeamCity, otherwise you might see "Unsupported major.minor version" errors related to the database driver classes.

...

  1. Create a new database. As the primary collation, it is recommended to use the collation corresponding to your locale. We also suggest using the case-sensitive collation (collation name ending with '_CS_AS'), which is mandatory for the certain functionality (like using non-Windows build agents).
  2. Create TeamCity user and ensure that this user is the owner of the database (grant the user dbo rights). This requirement is necessary because the user needs to have ability to modify the database schema.
    If you're going to use SSL connections, ensure that the version of MS SQL server and the version of java (on the TeamCity side) are compatible. We recommend using the latest update of SQL server:
    • SQL Server 2012 and later - all versions
    • SQL Server 2008R2 - Service Pack 2 or Service Pack 1 cumulative update 6
    • SQL Server 2008 - Service Pack 3 cumulative update 4
    • SQL Server 2005 - only with JDK 6 update 27 or lower on the TeamCity side
      See details on compatibility issues.
  3. Allocate sufficient transaction log space. The requirements vary depending on how intensively the server will be used. It's recommended to setup not less then 1Gb.
  4. Make sure SQL Server Browser is running
  5. Make sure TCP/IP protocol is enabled for SQL Server instance
  6. Anchor
    NoCount
    NoCount
    Make sure that the "no count"  setting is disabled: the enabled "no count" setting prevents TeamCity from starting queued builds. Disable the setting in the database defaults as follows: 
    1. In MS SQL Server Management Studio, connect to your database server.
    2. Right-click the server instance in Object Explorer.
    3. Choose Properties.
    4. Select the Connections tab.
    5. In the Default Connection Options frame, "no count" must be unchecked.

It is recommended to monitor the database performance regularly. For example,

...

It is recommended to monitor the database performance regularly. For example, perform reindexing once every several months.

...

  1. Download the MS sqljdbc_4.2.x package (.exe or .tar.gz depending on your TeamCity server platform) from the Microsoft Download Center.
  2. Unpack the downloaded package into a temporary directory.
  3. Copy the sqljdbc42.jar from the just downloaded package into the TeamCity Data Directory/lib/jdbc directory. The Integrated security setup will need additional steps, see below.
  4. Proceed with the TeamCity setup.

...

To specify additional settings, change <TeamCity Data Directory>\config\database.properties file while TeamCity server is not running:

If you use a named instance, you need to manually modify the <TeamCity Data Directory>\config\database.properties file and specify the instance name in the connection URL as follows:

...

  1. Determine the bitness of TeamCity server Java/JVM in use. You might want to use JVM with the same bitness as Windows. Note that you will need to perform manual switch to 64-bit JVM as by default 32 bit JVM is bundled.
  2. Copy the <sql_jdbc_home>/enu/auth/x86/sqljdbc_auth.dll (in case of 32-bit Java) or <sql_jdbc_home>/enu/auth/x64/sqljdbc_auth.dll (in case of 64-bit Java) file into a directory and specify the directory in "-Djava.library.path=DIRECTORY_WITH_DLL" TeamCity server JVM option. Reportedly, as an alternative to adding the JVM option, you can also copy the .dll into Windows/System32 directory and ensure that there are no other sqljdbc_auth.dll files in your system (in the PATH-listed directories).
  3. In the <TeamCity Data Directory>\config\database.properties file, specify the connection URL (with no user names or passwords) as follows:

    Code Block
    connectionUrl=jdbc:sqlserver://<host>:1433;databaseName=<database name>;integratedSecurity=true
    

    More details about setting up integrated security for MS SQL native JDBC driver can be found in Microsoft documentation for MS SQL 2005 and MS SQL 2008.

...