TeamCity
 
You are viewing the documentation for an earlier version of TeamCity.

Setting up an External Database

Last modified: 20 April 2023

TeamCity 3.0 supports MySQL and PostgreSQL. Oracle support was added in TeamCity 3.1.

This document 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.

    warning

    All the data you entered into TeamCity will be lost. To preserve your data refer to the Migrating to an External Database.

  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 for settingUpMySql, settingUpPostgreSql or settingUpOracle.

  5. Start server.

Setting up MySQL



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

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

  3. 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.

    note

    We recommend using UTF-8 character set for the database. Please consult Configuring UTF8 Character Set for MySQL for more details on how to create database with Unicode support.

  4. 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>

Setting up PostgreSQL



Supported PostgreSQL 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

Setting up Oracle



Supported Oracle versions: 10g+

  1. Download the Oracle JDBC Thin driver from: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html

  2. Put the driver jar (ojdbc14.jar) into the WEB-INF/lib directory of TeamCity web application

  3. Create an Oracle user account for TeamCity (with CREATE_TABLE permission). Do NOT grant this user any extra permissions, such as DBA role.

  4. 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