×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

谢各位我找到答案了:如果你用NT authentication,try to add 'Integrated Security=SSPI' in your connection string. -luoboyang(萝卜秧); 2003.10.14 14:29 (#1412109)。

[My wrong code:]

Data = "Provider=sqloledb;" & _
"Data Source=TPNT;" & _
"Initial Catalog=BD;"

Dim Conn, SQL, rs, fsw
Set Conn = CreateObject("ADODB.Connection")

Conn.Open Data
HandleErrors Err.Number, Err.Description, BreakPoint

SQL = "..."
Set rs = Conn.Execute(SQL)
...

[Errors I got:]
C:\data\junk>cscript test.vbs
...

C:\data\junk\test.vbs(13, 4) Microsoft OLE DB Provider for SQL Server: Login failed for user 'test'.

[here:]
IIS didn't pass full nt user information "domain\test" to SQl sever, only passed "test" as a sql login.

[right code:]
Data = "Provider=sqloledb;" & _
"Data Source=TPNT;" & _
"Initial Catalog=BD;" & _
"Integrated Security=SSPI;"
...


Works!
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / IIS和SQLSRV 必须在一台机器上才能用NT AUTHENTICATION吗? 在ADO 的开发中,当IIS与SQL 在不同机器上,用NT authentication通过IIS登陆SQLServer 出错。
    以下MSDN中说IIS和SQL SERVER必须在一台机器上,或IIS 就是DOMAIN CONTROLLER

    http://msdn.microsoft.com/library/d...ationmethod.asp

    公司大,不太可能把这个小IIS建在公司的DOMAIN CONTROLLER 上,IIS和SQLserver 在一起又怕影响SQL Server的效率。

    我想了一个土方法: 在IIS的机器上装一个中间SQLserver ,建好与原SQLSERVER一样的LOGIN group,LINK 原SQL Sserver ,NT用户先登陆此SQLServer , 在查询原SQLServer 。

    请问是不是有别的方案?
    • 我一般把IIS和SQL放在两个不同的机子上,APPLICATION SERVER和DATABASE SERVER分开好.
      • Can user use Nt authentication through IIS?
    • 不用。不过你的SQL Server必须是mixed login 方式,同时加入你的domain user as DB login才行。
    • 应该是可以的。只要那台sql服务器能访问域服务器。 但是如果只有一台数据库服务器,这样做的意义不大,还不如就用sql德,更方便
    • 谢各位我找到答案了:如果你用NT authentication,try to add 'Integrated Security=SSPI' in your connection string. -luoboyang(萝卜秧); 2003.10.14 14:29 (#1412109)。
      [My wrong code:]

      Data = "Provider=sqloledb;" & _
      "Data Source=TPNT;" & _
      "Initial Catalog=BD;"

      Dim Conn, SQL, rs, fsw
      Set Conn = CreateObject("ADODB.Connection")

      Conn.Open Data
      HandleErrors Err.Number, Err.Description, BreakPoint

      SQL = "..."
      Set rs = Conn.Execute(SQL)
      ...

      [Errors I got:]
      C:\data\junk>cscript test.vbs
      ...

      C:\data\junk\test.vbs(13, 4) Microsoft OLE DB Provider for SQL Server: Login failed for user 'test'.

      [here:]
      IIS didn't pass full nt user information "domain\test" to SQl sever, only passed "test" as a sql login.

      [right code:]
      Data = "Provider=sqloledb;" & _
      "Data Source=TPNT;" & _
      "Initial Catalog=BD;" & _
      "Integrated Security=SSPI;"
      ...


      Works!
      • 哈哈! 不过你描述的好像不是我想象的亚。:))