Setting up an External Database
Last modified: 20 April 2023TeamCity 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
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.
Run TeamCity with the default settings to create the <TeamCity Data Directory>.
Shutdown the TeamCity server.
Perform database-specific steps described below for settingUpMySql, settingUpPostgreSql or settingUpOracle.
Start server.
note
Please note that TeamCity actively modifies its own database schema. 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.
Setting up MySQL
Download the MySQL JDBC driver from: http://dev.mysql.com/downloads/connector/j/
Put MySQL connector jar to the
WEB-INF/lib
directory of TeamCity web applicationCreate 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.
In the
<TeamCity data directory>/config
folder renamedatabase.mysql.properties
file todatabase.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+
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.
In the
<TeamCity data directory>/config
folder create filedatabase.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+
note
Oracle support is available only since TeamCity 3.1
Download the Oracle JDBC Thin driver from: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html
Put the driver jar (
ojdbc14.jar
) into theWEB-INF/lib
directory of TeamCity web applicationCreate an Oracle user account for TeamCity (with CREATE_TABLE permission). Do NOT grant this user any extra permissions, such as DBA role.
In the
<TeamCity data directory>/config
folder create filedatabase.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
Thanks for your feedback!