Accessing SQL Server via Windows Authentication from Linux
See original GitHub issueI’m running dbeaver on Ubuntu 17.04
It appears I should be able to run kinit
and then dbeaver
and connect, but no such luck.
derek@043SC646:~$ kinit derbro
Password for derbro@MBA.AC.UK:
derek@043SC646:~$ klist
Ticket cache: FILE:/tmp/krb5cc_1000
Default principal: derbro@MBA.AC.UK
Valid starting Expires Service principal
13/04/18 15:13:43 14/04/18 01:13:43 krbtgt/MBA.AC.UK@MBA.AC.UK
renew until 20/04/18 15:13:35
derek@043SC646:~$ /usr/share/dbeaver/dbeaver
2018-04-13 15:14:00.044 - Create display
2018-04-13 15:14:00.110 - DBeaver 5.0.2 is starting
2018-04-13 15:14:00.111 - Install path: '/usr/share/dbeaver'
2018-04-13 15:14:00.111 - Instance path: 'file:/home/derek/.dbeaver4/'
with the jtds
driver, I get:
2018-04-13 15:14:29.233 - Connect with 'jdbc:jtds:sqlserver://cprdatabase.mba.ac.uk/master' (mssql_jdbc_jtds-162bf5b8666-1fbf43ea0d700a20)
2018-04-13 15:14:29.315 - Connection failed (mssql_jdbc_jtds-162bf5b8666-1fbf43ea0d700a20)
2018-04-13 15:14:29.316 - org.jkiss.dbeaver.model.exec.DBCConnectException: I/O Error: GSS Failed: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
org.jkiss.dbeaver.model.exec.DBCConnectException: I/O Error: GSS Failed: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:191)
at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.openConnection(GenericDataSource.java:126)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:79)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.initializeMainContext(JDBCDataSource.java:115)
at org.jkiss.dbeaver.ext.generic.model.GenericDataSource.<init>(GenericDataSource.java:108)
at org.jkiss.dbeaver.ext.mssql.model.SQLServerDataSource.<init>(SQLServerDataSource.java:43)
at org.jkiss.dbeaver.ext.mssql.model.SQLServerDataSource.<init>(SQLServerDataSource.java:35)
at org.jkiss.dbeaver.ext.mssql.SQLServerDataSourceProvider.openDataSource(SQLServerDataSourceProvider.java:123)
at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:752)
at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:70)
at org.jkiss.dbeaver.ui.dialogs.connection.ConnectionWizard$ConnectionTester.run(ConnectionWizard.java:216)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:95)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: java.sql.SQLException: I/O Error: GSS Failed: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:654)
at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:177)
... 12 more
Caused by: java.io.IOException: GSS Failed: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
at net.sourceforge.jtds.jdbc.TdsCore.sendMSLoginPkt(TdsCore.java:1976)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:617)
... 15 more
With the Microsoft driver it’s more onimous because it’s asking for a DLL, which isn’t ever going to be found on a Linux system, but in any case I don’t seem to have anything named sqljdbc_auth on my system:
2018-04-13 15:21:18.335 - Connect with 'jdbc:sqlserver://cprdatabase;databaseName=master' (mssql_jdbc_ms_new-162bf61c476-4e0f91af488ac42e)
Apr 13, 2018 3:21:18 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
https://blogs.msdn.microsoft.com/psssql/2015/01/09/jdbc-this-driver-is-not-configured-for-integrated-authentication/ implies that this means it’s trying to connect with a connection string containing authenticationScheme=NativeAuthentication
(either explicitly or implicitly–which would only work on Windows) and requires authenticationScheme=JavaKerberos
(which should work on any OS). I expect I could set that in the driver advanced parameters, but I’m not sure where–and also rather expect that if I did, I’d just end up with the same problem as with the jTds driver.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (1 by maintainers)
Top GitHub Comments
With jTDS just set
DOMAIN=
,USENTLMV2=True
,USER=
andPASSWORD=
on Driver Properties. If someone knows how to do this using the MS jdbc driver please let me know.Only if your Linux machine is authenticated on the Domain.
No, no. Thats gonna use Windows Authentication. For SQL Server Login you can you the MS JDBC driver, which is open source now. But using the MS JDBC with Windows AD you need to use Kerberos on your Linux machine, which could be a little complicated as it will need installation and configuration on the server side as well and your IT team may be laze for that.
Developers are bringing NTLM to MS JDBC as well: https://github.com/Microsoft/mssql-jdbc/issues/696; when this is working then you wouldn’t need jTDS anymore.