TeamCity 4.0 Help

Setting up an External Database

TeamCity supports MySQL, PostgreSQL, Oracle and MS SQL 2005 databases.

This page covers external database setup for the first use with TeamCity. If you evaluated TeamCity with internal database and want to preserve the data while switching to an external database, please refer to Migrating to an External Database guide.

General Steps

  1. If you already ran TeamCity but do not want to preserve any data, delete TeamCity Data Directory.

  2. Run TeamCity with the default settings to create the <TeamCity Data Directory>.

  3. Shutdown the TeamCity server.

  4. Perform database-specific steps described below.

  5. Start the server.

Database Configuration Properties

TeamCity uses Apache DBCP for database connection pooling. Please refer to http://commons.apache.org/dbcp/configuration.html for detailed description of configuration properties. Example configurations for each of supported databases are provided in sections below.

MySQL

Supported versions: (5.0.40+)

  1. Download the MySQL JDBC driver from: http://dev.mysql.com/downloads/connector/j/

  2. Extract downloaded archive in a temporary folder. In the unpacked folder locate a jar file which name looks like the following: mysql-connector-java- <version> -bin.jar (or similar). This would be MySQL connector.

  3. Put MySQL connector jar to the WEB-INF/lib directory of TeamCity web application

  4. Create an empty database for TeamCity in MySQL and grant permissions to modify this database to a user from which TeamCity will work with this database.

  5. In the <TeamCity data directory>/config folder rename database.mysql.properties file to database.properties and specify the required settings in this file:

    connectionUrl=jdbc:mysql://<host>/<database name> connectionProperties.user=<user> connectionProperties.password=<password>

PostgreSQL

Supported versions: 8+

  1. Create an empty database for TeamCity in PostgreSQL and grant permissions to modify this database to a user from which TeamCity will work with this database. Be sure to set up it to use UTF8.

  2. In the <TeamCity data directory>/config folder create file database.properties and specify the required settings in this file:

    driverName=org.postgresql.Driver connectionUrl=jdbc:postgresql://<host>/<database name> connectionProperties.user=<user> connectionProperties.password=<password> maxConnections=50 poolPreparedStatements=true

Oracle

Supported versions: 10+

  1. Create an Oracle user account for TeamCity (with CREATE_TABLE permission). It is important to ensure the user is NOT granted any extra permissions, such as DBA role.

  2. Download the Oracle JDBC Thin driver and put the driver jar (ojdbc14.jar) into the WEB-INF/lib directory of TeamCity web application. Please make sure use use the specified driver (version 10.2.0.1.0XE), earlier driver versions may not function properly with TeamCity.

  3. In the <TeamCity data directory>/config folder create file database.properties and specify the required settings in this file:

    driverName=oracle.jdbc.driver.OracleDriver connectionUrl=jdbc:oracle:thin:@<host>:1521:<service> connectionProperties.user=<user> connectionProperties.password=<password> maxConnections=5 poolPreparedStatements=true

Microsoft SQL Server 2005

Supported version: 2005

  1. Create new database, ensure that _CI_AI collation is selected for this database.

  2. Create TeamCity user and ensure the 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 database schema.

  3. Download latest jTDS driver and put it into WEB-INF/lib directory of TeamCity web application.

  4. In the <TeamCity data directory>/config folder create file database.properties and specify the required settings in this file:

    driverName=net.sourceforge.jtds.jdbc.Driver connectionUrl=jdbc:jtds:sqlserver://<host>:1433/<database name> connectionProperties.user=<user> connectionProperties.password=<password> maxConnections=50 poolPreparedStatements=true

To use Windows authentication just do not mention connectionProperties.user and connectionProperties.password properties.

Last modified: 20 April 2023