Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "no sqljdbc_auth in java.library.path" installing TeamCity on Windows Server 2012

I am installing TeamCity on a Windows 2012 Server. I'm at the database connection setup screen but getting this error.

"SQL error when doing: Taking a connection from the data source: no sqljdbc_auth in java.library.path"

I've copied the sqljdbc_auth.dll to the C:\Windows\System32 folder and added a system environment variable java.library.path that points to this folder.

like image 241
DomBurf Avatar asked Jul 27 '15 08:07

DomBurf


2 Answers

Teamcity installs the 32-bit version even if you're on a 64-bit platform unless you deliberately use 64-bit. So I am just going to give you the 32-bit instructions for using Windows authentication with Teamcity SQL database setup. The instructions are the same for the 64-bit setup, just change x86 to x64

  1. Create an empty database in SQL server
  2. Make sure the Windows account configured on the TeamCity service(s) have access to the database
  3. Copy sqljdbc42.jar to <TeamCity_data_dir>\lib\jdbc\sqljdbc42.jar
  4. Copy auth\x86\sqljdbc_auth.dll from the Microsoft download to <TeamCity_data_dir>\lib\sqljdbc_auth.dll
  5. Open System > Advanced System Settings > Environment Variables and add a System variable TEAMCITY_SERVER_OPTS set to the value -Djava.library.path=<TeamCity_data_dir>\lib or run setx TEAMCITY_SERVER_OPTS=-Djava.library.path=<TeamCity_data_dir>\lib
  6. Click OK on all dialogs and restart the Teamcity services.

Now you can connect Teamcity to the SQL server using Windows Authentication after which the wizard will create the database.

Edit: January 27, 2020

With the 2019.2.1 update I've had to move the sql_jdbcauth.dll file to <TeamCity_data_dir>\system\caches\jdbc\native\windows-i386 This could be just a bug in the upgrade process.

like image 192
Bron Davies Avatar answered Oct 01 '22 19:10

Bron Davies


You should check your TeamCity server log. Mine (located at c:\TeamCity\logs\teamcity-server.log) mentions the following:

[2019-03-20 07:54:56,045] INFO - jetbrains.buildServer.STARTUP - Native library sqljdbc_auth.dll was not found under either E:\BuildServer\lib\jdbc\native\windows-i386 or E:\BuildServer\lib\jdbc\native; will continue looking in sun.boot.library.path and java.library.path.

After putting the sqljdbc_auth.dll library in E:\BuildServer\lib\jdbc\native\windows-i386 and restarting the service everything was fine and dandy; without having to meddle with bin folders (they get reset during TC upgrades) or having to define environment variables.

like image 27
janv8000 Avatar answered Oct 01 '22 20:10

janv8000