Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to SQL Server from Linux via JDBC using integratedSecurity (Windows authentication)?

Hey I am having trouble connecting to an SQL Server with Java code that is running on Linux.

If I set integratedSecurity=true, then the java code fails with the following error:

WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId:b030b480-453d-4007-8151-a552150f74cd

which makes sense as there will be no sqljdbc.dll file on Linux.

But if I set integratedSecurity=false, then I get the following error:

 com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'IT_DEV_USER'.

So does anyone know how I can connect to SQL Server with integratedSecurity set to false? (Note that I cant even connect when the Java code is running on Windows when integratedSecurity is set to false.)

If not, is there any way I can get integratedSecurity working on Linux?

like image 763
fulhamHead Avatar asked Jun 18 '15 11:06

fulhamHead


People also ask

Can SQL Server use Windows Authentication?

A connection made using Windows Authentication is sometimes called a trusted connection, because SQL Server trusts the credentials provided by Windows. By using Windows Authentication, Windows groups can be created at the domain level, and a login can be created on SQL Server for the entire group.

How do I connect to SQL Server Remote using Windows Authentication?

Security & ConnectionsRight-click on your server name and click 'Properties'. Go to the Security page for Server Authentication, and select 'SQL Server and Windows Authentication' mode. Then, go to the Connections page and ensure that "Allow remote connections to this server" is checked, and click OK.


1 Answers

If you want to use integrated security and using JDBC Driver 4.0 or greater then you add the following in your jdbc connection string.

integratedSecurity=true;authenticationScheme=JavaKerberos

More information: http://blogs.msdn.com/b/psssql/archive/2015/01/09/jdbc-this-driver-is-not-configured-for-integrated-authentication.aspx

like image 53
hamnix Avatar answered Sep 17 '22 01:09

hamnix