java 此驱动程序未配置为集成身份验证
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32536608/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
This driver is not configured for integrated authentication
提问by Khairul Islam
Trying to connect my java web application with MS-SQL server using sqljdbc41
for jdk 1.8
. Here is the database connection code-
尝试使用sqljdbc41
for将我的 Java Web 应用程序与 MS-SQL 服务器连接起来jdk 1.8
。这是数据库连接代码-
Connection connection;
String url = "jdbc:sqlserver://localhost:1433;databaseName=Lista;integratedSecurity=true";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connection = DriverManager.getConnection(url);
when i am trying to insert some values to the database like-
当我尝试向数据库中插入一些值时,例如 -
PreparedStatement ps = connection.prepareStatement("INSERT INTO user_informations VALUES(?,?,?)");
ps.setString(1, "value");
ps.setString(2, "value");
ps.setString(3, "value");
ps.executeUpdate();
getting the following error each time-
每次都收到以下错误-
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication
com.microsoft.sqlserver.jdbc.SQLServerException: 此驱动程序未配置为集成身份验证
Here are some informations about what i have tried yet-
以下是有关我尝试过的内容的一些信息-
- i have added the path of
sqljdbc41
in the path variable. - i have added the path of
sqljdbc_auth.dll
in the path variable. - i have added the
sqljdbc41.jar
into myNebeans
project library. - i have added the
sqljdbc_auth.dll
into both bin folder underjdk
andjre
. - my
jdk
is64 bit
under program files folder not in program file(x86). - jdbc driver folder is also in program file directory.
- sql server and sql server browser services are also running.
- 我
sqljdbc41
在路径变量中添加了路径。 - 我
sqljdbc_auth.dll
在路径变量中添加了路径。 - 我已将其添加
sqljdbc41.jar
到我的Nebeans
项目库中。 - 我已经添加了
sqljdbc_auth.dll
下到两个bin文件夹jdk
和jre
。 - 我
jdk
就是64 bit
在Program Files文件夹没有程序文件(x86)的。 - jdbc 驱动程序文件夹也在程序文件目录中。
- sql server 和 sql server 浏览器服务也在运行。
Edit
编辑
Now i experiencing a new thing-after restarting my pc when i deploy the project for the first time then it is working perfectly but when i make any change in my code and re-run the project it's not working!
现在我遇到了一个新事物 - 在我第一次部署项目时重新启动我的电脑后,它运行良好,但是当我对代码进行任何更改并重新运行该项目时,它无法正常工作!
采纳答案by Khairul Islam
I solved my problem!
我解决了我的问题!
The error (described in my question above) i was getting because the glassfish
server had not any access on sqljdbc42.jar
file. so i have placed the sqljdbc42.jar
file into my glassfish
server in this location-
我得到的错误(在我上面的问题中描述)是因为glassfish
服务器没有任何sqljdbc42.jar
文件访问权限。所以我已将sqljdbc42.jar
文件放入我的glassfish
服务器中的此位置-
glassfish-4.1\glassfish\domains\domain1\lib
glassfish-4.1\glassfish\domains\domain1\lib
And it's now working perfectly.
它现在运行良好。
Thank you everyone!
谢谢大家!
回答by demon36
The problem for me was that there were 2 java installations, one of them was the standard installation and it was 64bit, the other one was included in my oracle jdeveoper installation (it was the one used by the application giving that error) and surprisingly it was 32bit. I just put the correct dll in the java installation used by my application and everything went well
我的问题是有 2 个 java 安装,其中一个是标准安装,它是 64 位的,另一个包含在我的 oracle jdeveoper 安装中(它是应用程序使用的那个错误),令人惊讶的是它是 32 位的。我只是将正确的 dll 放在我的应用程序使用的 java 安装中,一切顺利
回答by MiguelSlv
sqljdbc_auth.dll
is need to use windows authentication or Kerberos authentication.
sqljdbc_auth.dll
需要使用 windows 身份验证或 Kerberos 身份验证。
Get the dll from Microsoftand install it either by:
从Microsoft获取 dll并通过以下方式安装它:
- drop on application library folder
- drop on the java bin folder (attention if you have multiple java installations)
drop the library on some folder and then add the path in the command line:
java -Djava.library.path=<library path>...
- 放入应用程序库文件夹
- 放到 java bin 文件夹中(注意,如果你有多个 java 安装)
将库放在某个文件夹上,然后在命令行中添加路径:
java -Djava.library.path=<library path>...
The mssql-jdbc driver and the auth dll should be:
mssql-jdbc 驱动程序和 auth dll 应该是:
- on the same folder (but not mandatory)
- both from the same version
- for the same architecture (x86/x64) JVM is running.
- 在同一个文件夹中(但不是强制性的)
- 都来自同一个版本
- 对于相同的架构 (x86/x64) JVM 正在运行。
Check also the jdbc compatibility matrix with java versions on the download page.
还可以在下载页面上检查 jdbc 与 java 版本的兼容性矩阵。