Configuring Integrated Security for a TeamCity SQL Database December, 2013
Configuring integrated security for a TeamCity database is pretty simple but if you don’t get it just right you’ll get this error without further explanation:
SQL error when doing: Connecting to MSSQL: This driver is not configured for integrated authentication.
Here is how to set it up:
Note: I’ll be refering to the TeamCity home and data directories. Typically they will be under C:\Program Files\TeamCity
but may be under different paths on your system. See here and here for more info.
- Download the Microsoft JDBC Driver for SQL Server and extract the files.
- Copy the
\sqljdbc4.jar
file to the<TeamCityDataDir>\lib\jdbc
folder (You will have to create thejdbc
folder).
If you are running a 32 bit OS:
- Copy the
\auth\x32\sqljdbc_auth.dll
file (Note thex32
in the path) to the<TeamCityHomeDir>\bin
folder. - Restart TeamCity server and agents.
If you are running a 64 bit OS:
- Copy the
\auth\x64\sqljdbc_auth.dll
file (Note thex64
in the path) to the<TeamCityHomeDir>\bin
folder. - Download the 64 bit Windows
tar.gz
version (Not the installer) of the JRE here and uncompress it. Depending on your compression tool you may have to then extract the files from the tar archive (Which may not have an extension) as a second step. 7-zip will do this. - Delete the contents of the
<TeamCityHomeDir>\jre
folder. - Copy the JRE that you extracted in the previous step to the
<TeamCityHomeDir>\jre
folder. The JRE is one folder deep in the archive so don’t just directly copy the folder that is extracted. Your<TeamCityHomeDir>\jre
folder should contain abin
andlibs
folder. - Make a backup of your
<TeamCityHomeDir>\jre
folder under<TeamCityHomeDir>\jre\x64
(Or wherever you prefer). TeamCity upgrades overwrite the the JRE with the 32 bit version, so you’ll want to have a copy handy so you can replace it after updates. - Restart TeamCity server and agents.
As mentioned above when you upgrade TeamCity, the jre
folder is overwritten with the 32 bit version of the JRE. So if you’re using the 64 bit version this will lead to the following error when you restart:
You will need to stop the TeamCity server and agents, replace the x32
version with the x64
version as described above, and restart the services.
Thanks to dneelyep for his corrections.