Using windows authentication with sqljdbc.jar

隐身守侯 提交于 2020-01-15 07:45:27

问题


Is it possible to use the windows authentication mode for SQL SERVER database, while using the micro soft provided JDBC drivers?

I am using sqljdbc.jar.. the SQLJdbcVersion class file contains this:

  static final int major = 2;
  static final int minor = 0;
  static final int MMDD = 1803;
  static final int revision = 100;

Any comments?

Is there a reason why sqljdbc can not use windows authentication?

I am using Websphere application server 7 and running a j2ee application. The datasources are created in the WAS itself.

Thanks


回答1:


Yes you can use windows authentication with JDBC driver provided by Microsoft

jdbc:sqlserver{HOST};Database={DB_NAME};integratedSecurity=true




回答2:


It is possible, but only if you are running in a Windows environment since the integratedSecurity=true requires access to sqljdbc_auth.dll. To my knowledge, this native library has not been ported to any other platform. For obvious reasons, since it uses the windows credentials the jvm process is running under to authenticate against SQL Server.

The dll should not be on the class path, but on the java library path. Easiest way is to copy the sqljdbc_auth.dll to the [jre]\bin folder.




回答3:


On the datasource there is a rarely used link for "Custom Properties". On this page one of the custom properties is integrated_security which defaults to false. Change it's value to true.

You must also have the "sqljdbc_auth.dll" file on your lib path, as several other questions mention. We put it in the same folder as the jar, and point the Websphere instance to that path on as the native library path (on the provider configuration screen).




回答4:


you can use springjdbc.jar only if you jre is less than 1.7

otherwise you have to use springjdbc4.jar and this does not support integrated authentication



来源:https://stackoverflow.com/questions/6938717/using-windows-authentication-with-sqljdbc-jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!