SQL Server does not connect using Windows domain authentication

{
  "browser-info": {
    "language": "es-ES",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "Cp1252",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.13+8",
    "java.vendor": "Eclipse Adoptium",
    "java.vendor.url": "https://adoptium.net/",
    "java.version": "11.0.13",
    "java.vm.name": "OpenJDK Client VM",
    "java.vm.version": "11.0.13+8",
    "os.name": "Windows Server 2019",
    "os.version": "10.0",
    "user.language": "en",
    "user.timezone": "America/Mexico_City"
  },
  "metabase-info": {
    "databases": [
      "sqlserver",
      "mysql",
      "oracle"
    ],
    "hosting-env": "unknown",
    "application-database": "mysql",
    "application-database-details": {
      "database": {
        "name": "MySQL",
        "version": "8.0.27"
      },
      "jdbc-driver": {
        "name": "MariaDB Connector/J",
        "version": "2.6.2"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2021-12-16",
      "tag": "v0.41.5",
      "branch": "release-x.41.x",
      "hash": "fbfffc6"
    },
    "settings": {
      "report-timezone": "America/Mexico_City"
    }
  }
}

Hello, I am setting up the connection to the SQL Server database but it requires domain authentication, since it is a policy of my IT department.

I have already tried with some JDBC driver options but it sends the error: Login failed for user

Any ideas?

Hi @Arturo77
So you are connecting with NTLM?
Which options have you tried with? domainName?
How would you connect with using something like DBeaver or another JDBC client?
For reference: https://docs.microsoft.com/en-us/sql/connect/jdbc/setting-the-connection-properties?redirectedfrom=MSDN&view=sql-server-ver15

Hi @flamber
I use this options "integratedSecurity=true;authenticationScheme=ntlm;domain=xxx".

I have another instance of Metabase version 0.21 on the same server and I successfully connect to the database, in this instance I don't use any extra options to connect.

@Arturo77 That's a really really old version of Metabase, which used a very different driver at that point.
Metabase now uses the official Microsoft JDBC driver v9.2.1.

I don't how strict the driver is, but the documentation says it should be authenticationScheme=NTLM
And while including the domainName, you'll also need to use the Windows credentials in the userName.

Again, have you tried with any other JDBC client with a modern driver?

@flamber

I have downloaded the driver mssql-jdbc-9.2.1.jre8.jar and tested with Dbeaver being successful

2806

@Arturo77 Great, then post a screenshot of what you're filling out on DBeaver and in Metabase.

DBeaver
Sin%20t%C3%ADtulo

Metabase
2807


@Arturo77 Are you sure that JDBC understands Spanish? Try with authenticationScheme=NTLM
Check what DBeaver is generating by selecting your database in the left panel, then go to the top-menu Window > Show View > Properties.

@flamber I had the translator active when I copied the line "authenticationScheme=NTLM" so I copied it in Spanish ( hehehe ).

I don't see the "properties" option in "Window > Show View > Properties" inside DBearv
2810

I have right clicked on my database > Edit Connection and on the Driver Properties tab


2812

@Arturo77 I would recommend that you check your database logs, which should hint at what it is receiving and what the problem could be.
Also see this: https://github.com/dbeaver/dbeaver/issues/11652#issuecomment-840403607

@flamber I already managed to make the successful connection.

To fix this, copy the mssql-jdbc_auth-9.2.1.x64.dll and mssql-jdbc_auth-9.2.1.x86.dll libraries into the jre\bin and jre\lib folders.

Thanks very much for your time and support

1 Like