Connect To SQL Server With Windows Authentication From A Linux Machine Through JDBC

zuckermanori picture zuckermanori · Jun 15, 2016 · Viewed 45.6k times · Source

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

My question is how do I do it from a Linux machine.

Thanks

Answer

zuckermanori picture zuckermanori · Jun 15, 2016

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