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

前端 未结 2 1006
一整个雨季
一整个雨季 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:

    \sqljdbc_\\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_\enu\auth\x86

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

提交回复
热议问题