Java 我如何调用 sqljdbc_auth.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20663914/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 03:25:52  来源:igfitidea点击:

how do I call sqljdbc_auth.dll

javasqleclipsedlljdbc

提问by wjhplano

I'm using eclipse and want to make an sql database connection I put the sqljdbc_auth.dll in the buildpath
I'm getting this error message

我正在使用 eclipse 并且想要建立一个 sql 数据库连接我将 sqljdbc_auth.dll 放在构建路径中
我收到此错误消息

Dec 18, 2013 10:45:54 AM com.microsoft.sqlserver.jdbc.AuthenticationJNI clinit>
WARNING: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
This driver is not configured for integrated authentication. ClientConnectionId:7a06f...

2013 年 12 月 18 日上午 10:45:54 com.microsoft.sqlserver.jdbc.AuthenticationJNI clinit>
警告:无法加载 sqljdbc_auth.dll 原因:java.library.path 中没有 sqljdbc_auth
此驱动程序未配置为集成身份验证。客户端连接 ID:7a06f...

What am I doing wrong here?

我在这里做错了什么?

采纳答案by wjhplano

I solved the problem.

我解决了这个问题。

-Djava.library.path=C:\bla\path\where\the\dll\is

-Djava.library.path=C:\bla\path\where\the\dll\is

just needed quotes around it like this

只需要像这样在它周围引用

"-Djava.library.path=C:\Program Files (x86)\jdbc\sqljdbc_4.0\enu\auth\x86"

“-Djava.library.path=C:\Program Files (x86)\jdbc\sqljdbc_4.0\enu\auth\x86”

回答by unwichtich

The DLL file has to be present in one of the locations of your PATHenvironment var.

DLL 文件必须存在于您的PATH环境变量的位置之一。

It may already help to copy the file to the folder windows\system32or the binfolder of your JRE/JDK. Restart Eclipse and try again.

将文件复制到JRE/JDK的文件夹windows\system32bin文件夹中可能已经有所帮助。重新启动 Eclipse 并重试。

If this doesn't work you can also specify the parameter java.library.pathin your Eclipse Run Configurationlike this:

如果这不起作用,您还可以java.library.path在 Eclipse 中指定参数,Run Configuration如下所示:

-Djava.library.path=C:\bla\path\where\the\dll\is

Alternativly you can follow this answerwhich describes in detail how to setup the parameter for a complete project.

或者,您可以遵循此答案,其中详细描述了如何为完整项目设置参数。

See also:

也可以看看:

回答by Nilster

If the JDBC is still using 32 bit sqljdbc_auth.dll, it could be because the PATH variable has found 64 bit dll before it gets to the newly added PATH environment variable. Add location of the 64 bit sqljdbc_auth.dll in the very beginning of the PATH system variable. In my case it was

如果 JDBC 仍然使用 32 位 sqljdbc_auth.dll,那可能是因为 PATH 变量在到达新添加的 PATH 环境变量之前已经找到了 64 位 dll。在 PATH 系统变量的最开始添加 64 位 sqljdbc_auth.dll 的位置。就我而言,它是

C:\nilster\JDBC\sqlserver-sqljdbc_4.2\enu\auth\x64

C:\nilster\JDBC\sqlserver-sqljdbc_4.2\enu\auth\x64

This helped me get around to the issue.

这帮助我解决了这个问题。