tags:

views:

179

answers:

3

We had a machine that run teamcity 4.0.2 and that used SqlServer 2005 as datastore. The machine crashed, but we still have the database. How can I get a newly created instance of teamcity connected to the database?

I found infos about migrating an existing teamcity installation over to a new database. But thats not what I want.

EDIT: I thought that the database contains the configuration for the projects. Thats not the case: Its in the folder Configuration of the Teamcity data directory (.BuildServer)

I only had to copy the contents of that folder over to my new installation. I guess my question was wrong. Anyway I leave it as it is, because there might be others who have the same idea.

A: 

I don't know how team city works, so I might not have the best answer. However could you not try backing up the DB, reinstalling team city and then restoring the backup DB over the instance created by teamcity?

RichardOD
+2  A: 

Start TeamCity using the internal database so that the TeamCity configuration directory is recreated (unless you have a backup of that already).

Then shut down TeamCity and copy the database driver (latest version is jtds-1.2.2.jar) to TeamCity\webapps\ROOT\WEB-INF\lib and create the database.properties file in .BuildServer\config\database.properties:

driverName=net.sourceforge.jtds.jdbc.Driver
connectionUrl=jdbc:jtds:sqlserver://192.168.1.99:1433/TeamCityDB
connectionProperties.user=teamcity_user
connectionProperties.password=teamcity_passwd 
maxConnections=50
poolPreparedStatements=true

Restart TeamCity and you should be good to go.

CoverosGene
A: 
  1. Download the MSSQL driver and copy it to WEB-INF/lib of your TeamCity install (probably under program files if you're running Windows).

  2. Create a file called database.properties in your config directory (under Windows it's usually Documents and settings\user_who_ran_install.buildserver\config) and put the following lines into it:

    driverName=net.sourceforge.jtds.jdbc.Driver connectionUrl=jdbc:jtds:sqlserver://:1433/ connectionProperties.user= connectionProperties.password=

    maxConnections=50 poolPreparedStatements=true

Restart TeamCity Web Server service. There's a nonzero chance it won't come back up or will be unreachable. Follow the instructions here to the letter and you should be OK. Make sure to have a backup of your database available in case TeamCity decides to reinstall all the data objects for some reason.

Chris McCall
Hi Chris,the nonzero chance is real. And the teamcity guys realy reinstall the data. As soon as I point to the restored database everything gets deleted again. I guess I have to transfer table after table from my backup to the new database.
Malcolm Frexner
Teamcity has its quirks (very few and usually only during setup or when developers hammer on the UI), but it's an excellent product with really broad support for a number of configurations. Good luck!
Chris McCall
I was wrong about the "deleting teamcity guys". I completely misunderstood the role of the database for teamcity. I updated the question ...and I totally agree that this is a very nice product.
Malcolm Frexner