Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
179 views
in Technique[技术] by (71.8m points)

java - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...