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
If you already ran TeamCity but do not want to preserve any data, delete TeamCity Data Directory.
Run TeamCity with the default settings to create the <TeamCity Data Directory>.
Shutdown the TeamCity server.
Perform database-specific steps described below.
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+)
Download the MySQL JDBC driver from: http://dev.mysql.com/downloads/connector/j/
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.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.
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>
PostgreSQL
Supported 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
Oracle
Supported versions: 10+
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.
Download the Oracle JDBC Thin driver and put the driver jar (
ojdbc14.jar
) into theWEB-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.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
Microsoft SQL Server 2005
Supported version: 2005
Create new database, ensure that _CI_AI collation is selected for this database.
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.
Download latest jTDS driver and put it into
WEB-INF/lib
directory of TeamCity web application.In the
<TeamCity data directory>/config
folder create filedatabase.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.