I / O错误:SSO失败:未加载本机SSPI库 [英] I/O Error: SSO Failed: Native SSPI library not loaded

查看:334
本文介绍了I / O错误:SSO失败:未加载本机SSPI库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行以下代码:

I am trying to run the following bit of code:

import java.sql.DriverManager;

public class Connect {
    public static void main(String[] args){
        try{
            String databaseDriver = "net.sourceforge.jtds.jdbc.Driver";
            Class.forName(databaseDriver);
        }
        catch (Exception e) {
            e.printStackTrace();
        }

        try{
            String url = "jdbc:jtds:sqlserver://BHX:1433/Forecast;instance=SQLEPXRESS";
            java.sql.Connection con = DriverManager.getConnection(url);
            System.out.println("Connection");
        }
        catch (Exception e){
            e.printStackTrace();
        }
    }
}

我的SQL服务器正在运行机器BHX上的端口1433。

My SQL server is running on port 1433 on machine BHX.

我得到的错误信息如下:

The error message I'm getting is as follows:

java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library not loaded. Check the     java.library.path system property.
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:615)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:352)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:185)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Connect.main(Connect.java:14)
Caused by: java.io.IOException: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.
at net.sourceforge.jtds.jdbc.TdsCore.sendMSLoginPkt(TdsCore.java:1893)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:588)
... 6 more

我已经了解了为什么会出现这种情况并发现类似问题< a href =https://stackoverflow.com/questions/4219968/java-sql-sqlexception-io-error-sso-failed-native-sspi-library>这里,但似乎没有工作。运行代码时,我已经包含以下参数来查找SSO文件:

I've read up on why this usually occurs and found a similar question here, but this doesn't seem to work. When running the code I've inlcuded the following argument to locate the SSO file:

-Djava.library.path=/Tester/jdbc/x64/SSO

这是我文件的结构

**Tester**
   *src*
     default package
         Connect.java
   *JRE System Library*
   *jdbc*
     conf
     html
     IA64
     x64
       SSO
        ntlmauth.dll
     x86

你能发现什么问题吗?

推荐答案

似乎与此问题相同: jtds-driver-not-working-for-sql-sever-2008r2-and-denali-native-sspi-library-not

你应该从 JTDS下载包到您的JRE bin文件夹中。

You should drop the appropriate ntlmauth.dll file from the JTDS download package into your JRE bin folder.

如果您在64位Windows机器上运行:

If you're running on a 64bit Windows machine:


  • 这个32位DLL:

  • This 32bit DLL:


下载>>> jtds-1.3.0-dist.zip >>> x86 >>> SSO >> > ntlmauth.dll

Downloads >>> jtds-1.3.0-dist.zip >>> x86 >>> SSO >>> ntlmauth.dll


  • 在这个32位的JRE位置到这里:

  • Goes here in this 32bit JRE location:


    C:\Program Files(x86)\ Java \ jre7 \ bin

    C:\Program Files (x86)\Java\jre7\bin


  • 这个64位DLL:

  • This 64bit DLL:


    下载>>> jtds-1.3.0-dist.zip >>> x64 >>> SSO >>> ntlmauth.dll

    Downloads >>> jtds-1.3.0-dist.zip >>> x64 >>> SSO >>> ntlmauth.dll


  • 在64位JRE位置到这里:

  • Goes here in this 64bit JRE location:


    C:\Program Files\Java \ jre7 \ bin

    C:\Program Files\Java\jre7\bin


  • 如果您在32位Windows机器上运行:

    If you're running on a 32bit Windows machine:


    • 这32位DLL:

    • This 32bit DLL:


    下载>>> jtds-1.3.0-dist.zip >>> x86 >>> SSO >>> ntlmauth .dll

    Downloads >>> jtds-1.3.0-dist.zip >>> x86 >>> SSO >>> ntlmauth.dll


  • 在这个32位的JRE位置到这里:

  • Goes here in this 32bit JRE location:


    C:\Program Files \\ \\ java \ jre7 \ bin

    C:\Program Files\Java\jre7\bin


  • 如果那不起作用那么尝试在main方法的顶部添加此行:
    System.out.println(java.lang.System.getProperty('java.library.path'));

    If that doesn't work then try adding this line at the top of your main method: System.out.println(java.lang.System.getProperty('java.library.path'));

    它应输出程序使用的实际JRE路径。确保相应的ntlmauth.dll位于该JRE的bin文件夹中。

    It should output the actual JRE path being used by your program. Make sure the appropriate ntlmauth.dll is in that JRE's bin folder.

    注意:使用此方法时,请勿设置连接的域,用户或密码属性。

    NOTE: Do NOT set the domain, user, or password properties of the connection when utilizing this method.

    注意:如果您的Java客户端程序在非Windows机器上运行,那么使用ntlmauth.dll方法就不顺利了。这是JTDS下载包附带的文档中的引用:下载>>> jtds-1.3.0-dist.zip >>> README.SSO

    NOTE: If your Java client program is running on a non-windows machine, you're out of luck using the ntlmauth.dll method. This is a quote from the documentation included with the JTDS download package: Downloads >>> jtds-1.3.0-dist.zip >>> README.SSO


    从0.9.2版本开始,jTDS能够使用当前用户的Windows
    凭证,其客户端程序运行的帐户是
    ,用于登录SQL Server(Windows Single Sign On) 。

    Starting with release 0.9.2 jTDS is capable of using the Windows credentials of the current user under whose account the client program is running to login to SQL Server (Windows Single Sign On).

    使用Windows单点登录(SSO)客户端将能够连接到
    Microsoft SQL Server而无需提供凭据。它将动态
    读取当前用户的凭据并连接到数据库。只要
    ,Windows帐户在数据库中拥有足够的权限。这是使用
    本机(仅限Windows)库ntlmauth.dll完成的。

    Using Windows Single Sign On (SSO) clients will be able to connect to Microsoft SQL Server without providing credentials. It would dynamically read current user's credentials and connect to the database. provided that the Windows account has enough rights in the database. This is done using a native (Windows-only) library, ntlmauth.dll.

    这篇关于I / O错误:SSO失败:未加载本机SSPI库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆