Connect my Sql Server 2008 database to my Java Project with Windows Authentication

前端 未结 2 1009
一整个雨季
一整个雨季 2021-01-07 12:58

I have the following problem: I can not connect my Sql Server database to my Java project.My Database is SQL Server 2008 R2. and have the Windows Authentication mode.   I ha

相关标签:
2条回答
  • 2021-01-07 13:24

    The JDBC driver supports the use of Type 2 integrated authentication on Windows operating systems through the integratedSecurity connection string property. To use integrated authentication, copy the sqljdbc_auth.dll file to a directory on the Windows system path on the computer where the JDBC driver is installed. The sqljdbc_auth.dll files are installed in the following location:

    <installation directory>\sqljdbc_<version>\<language>\auth\
    

    For any operating system supported by the Microsoft JDBC Driver for SQL Server, see Using Kerberos Integrated Authentication to Connect to SQL Server for a description of a feature added in Microsoft JDBC Driver 4.0 for SQL Server that allows an application to connect to a database using integrated authentication with Type 4 Kerberos.

    Note: If you are running a 32-bit Java Virtual Machine (JVM), use the sqljdbc_auth.dll file in the x86 folder, even if the operating system is the x64 version. If you are running a 64-bit JVM on a x64 processor, use the sqljdbc_auth.dll file in the x64 folder. Alternatively you can set the java.libary.path system property to specify the directory of the sqljdbc_auth.dll.

    For example, if the JDBC driver is installed in the default directory, you can specify the location of the DLL by using the following virtual machine (VM) argument when the Java application is started: -Djava.library.path=C:\Microsoft JDBC Driver 4.0 for SQL

    Server\sqljdbc_<version>\enu\auth\x86

    http://msdn.microsoft.com/en-us/library/ms378428.aspx

    0 讨论(0)
  • 2021-01-07 13:47

    The error you are getting suggests that the issue is with the JDBC driver, not with the database or the application code.

    As per the Microsoft forums, the issue is fixed with version 1.2 of the driver. Please try to download this version as it should solve your problem.

    The latest version can be found at http://www.microsoft.com/en-in/download/details.aspx?id=11774

    Reference: http://www.microsoft.com/en-in/download/details.aspx?id=11774

    0 讨论(0)
提交回复
热议问题