javasql-serverjdbcwindows-authentication

Connect to SQL Server with Windows authentication from a Linux machine through JDBC


I want to be able to connect to a SQL Server using JDBC and Windows authentication. I saw some answers on the internet saying I should add the following property to the connection string:

integratedSecurity=true;

And also add

sqljdbc_auth.dll

To the Java path.

But this, as far as I understand, applies only when I'm connecting from a Windows machine. When I try this on a Linux machine I get:

java.sql.SQLException: This driver is not configured for integrated authentication

How do I do it from a Linux machine?


Solution

  • Well, eventually I answer my own question: This is not possible to use Windows authentication from a linux machine using the Microsoft JDBC driver. This is possible using the jTDS JDBC driver using the following connection string:

    jdbc:jtds:sqlserver://host:port;databaseName=dbname;domain=domainName;useNTLMv2=true;
    

    Thank you all for all the comments