Problem with MS SQL Windows authentication on a linux container

In preparation of hosting Teamcity on AKS (Kubernetes on Azure), i'm running it locally in a Linux docker container. I'm using the official Jetbrains container from the Docker hub, version: 2018.2.4-linux. I have it up and running on a Windows 10 testmachine using a MS SQL database on the designated MS SQL server. The data and logs folders are mapped to a local folder on the test machine. Now i'm trying to make the step to Windows authentication. I followed the instructions on this page https://confluence.jetbrains.com/display/TCD18/Setting+up+TeamCity+with+MS+SQL+Server#SettingupTeamCitywithMSSQLServer-integratedSecurityAuth, but i'm having a problem getting it to work. The manual asks me to put sqljdbc_auth.dll in %data%\lib\jdbc\native\windows-amd64\, but it is a Linux container so a dll will not work (tried it, error message is below). The error mentiones a libsqljdbc_auth.so, but i cant find any documentation about this.

This is the error i get during configuring in the webinterface:
Could not connect to the database: no sqljdbc_auth in java.library.path. To make the native part of the driver available, you can place libsqljdbc_auth.so into the '/data/teamcity_server/datadir/lib/jdbc/native/linux-amd64' directory.

In the server log i get this error:
29-Apr-2019 08:43:25.586 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 4442 ms
TeamCity version: 2018.2.4 (build 61678), data format version 875
OS: Linux, version 4.9.125-linuxkit, amd64, Current user: root, Time zone: GMT (UTC)
Java: 1.8.0_192, OpenJDK 64-Bit Server VM (25.192-b12, mixed mode), OpenJDK Runtime Environment (1.8.0_192-b12), Oracle Corporation; JVM parameters: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Djava.util.logging.config.file=/opt/teamcity/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Xmx512m -Dteamcity.configuration.path=../conf/teamcity-startup.properties -Dlog4j.configuration=file:/opt/teamcity/bin/../conf/teamcity-server-log4j.xml -Dteamcity_logs=/opt/teamcity/bin/../logs -Djava.awt.headless=true -Dignore.endorsed.dirs= -Dcatalina.base=/opt/teamcity -Dcatalina.home=/opt/teamcity -Djava.io.tmpdir=/opt/teamcity/temp
Startup confirmation is required. Open TeamCity web page in the browser. Server is running at http://localhost:8111
[2019-04-24 11:45:25,597] ERROR - jetbrains.buildServer.STARTUP - no sqljdbc_auth in java.library.path

java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<clinit>(AuthenticationJNI.java:54)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3381)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:85)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3373)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7344)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2713)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2261)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1921)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1762)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1077)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:623)
at jetbrains.buildServer.serverSide.db.jdbcLoader.JdbcDataSource.getConnection(JdbcDataSource.java:182)
at jetbrains.buildServer.serverSide.db.DBFunctions.create(DBFunctions.java:258)
at jetbrains.buildServer.serverSide.db.DBFunctions.create(DBFunctions.java:243)
at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.createNewDBFunctions(TeamCityDatabaseManager.java:776)
at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.connect(TeamCityDatabaseManager.java:586)
at jetbrains.buildServer.maintenance.StartupProcessor.performConnectToDatabaseInternal(StartupProcessor.java:1088)
at jetbrains.buildServer.maintenance.StartupProcessor.performConnectToDatabase(StartupProcessor.java:561)
at jetbrains.buildServer.maintenance.StartupProcessor.doCreateNewDatabase(StartupProcessor.java:813)
at jetbrains.buildServer.maintenance.StartupProcessor.access$700(StartupProcessor.java:699)
at jetbrains.buildServer.maintenance.StartupProcessor$3.call(StartupProcessor.java:3)
at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:91)
at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStage(StartupProcessor.java:117)
at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStageSafe(StartupProcessor.java:672)
at jetbrains.buildServer.maintenance.StartupProcessor.processTeamCityLifecycle(StartupProcessor.java:48)
at jetbrains.buildServer.maintenance.StartupProcessor.access$000(StartupProcessor.java:317)
at jetbrains.buildServer.maintenance.StartupProcessor$1.run(StartupProcessor.java:3)
at java.lang.Thread.run(Thread.java:748)
[2019-04-24 11:45:25,600] ERROR - jetbrains.buildServer.STARTUP - Could not connect to the database: no sqljdbc_auth in java.library.path. To make the native part of the driver available, you can place libsqljdbc_auth.so into the '/data/teamcity_server/datadir/lib/jdbc/native/linux-amd64' directory.

0
2 comments

Hi,

 

I've been taking a look and it seems like this would be an issue with Microsoft's own JDBC driver. Microsoft only provides the ".dll" file, and if you check the stacktrace, it's microsoft's own driver trying to load the library via the JVM. I've tried to search for a linux library, but the only one I found was abandoned 11 years ago, so I can't really recommend using it, as it probably won't be useful.

 

At this point, I can only recommend not using windows authentication on a linux host. On this link there are some hints at how to make it work https://stackoverflow.com/questions/37835929/connect-to-sql-server-with-windows-authentication-from-a-linux-machine-through-j , but in our testing, the jTDS wasn't meeting our requirements either and generated a separate array of issues, so we usually discourage from using the jtds driver. If you are going to need windows authentication, please feel free to test the jtds driver.

 

I'd also recommend requesting to microsoft that they add linux support to their library, which is rare that it's not there because they already do serve the library in a .tar.gz file.

1
Avatar
Permanently deleted user

Thank you for looking in to it. We will configure it using SQL authentication for now.

We will also reach out to Microsoft and ask for support on this scenario.

0

Please sign in to leave a comment.