转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 数据库 >> Sql Server >> 正文
理解SQL Server 2000的信任连接(Trusted connection)         

理解SQL Server 2000的信任连接(Trusted connection)

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1111 更新时间:2007/11/14 12:56:57

我在用OLEDB方式连接SQL Server时, 用到连接字: "provider=SQLOLEDB.1;data source=localhost;initial catalog=WroxBooks; Trusted_Connection=yes; User ID=sa;Password=;"
调用后一直无法正常连接。

ASP.NET错误描述:
* Error while accessing data.
用户 ''''CXY\ASPNET'''' 登录失败。

ASP错误描述:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
用户 ''''CXY\IUSR_CXY'''' 登录失败。

已确信所连接的数据源,帐号和口令都是正确的,根据出错描述,怎么连接会用

CXY\ASPNET或CXY\IUSR_CXY登录?(我已明确指定User ID=sa;Password=;),经过多

次试验,最后将连接字中的Trusted_Connection=yes;删除,连接成功!

如果明白SQL Server登录验证的原理, 就可以知道Trusted Connection的含义。
在SQL Server Architecture(SQL Server架构)登录篇中有关于Authenticating Logins(登录验证)的讲述, 摘录如下:

......

SQL Server 2000 uses two types of authentication: Windows Authentication

and SQL Server Authentication.

......

When using Windows Authentication, you do not have to specify a login ID

or password when you connect to SQL Server 2000. Your access to SQL

Server 2000 is controlled by your Windows NT or Windows 2000 account or

group, which is authenticated when you log on to the Windows operating

system on the client.

When you connect, the SQL Server 2000 client software requests a Windows

trusted connection to SQL Server 2000. Windows does not open a trusted

connection unless the client has logged on successfully using a valid

Windows account. The properties of a trusted connection include the

Windows NT and Windows 2000 group and user accounts of the client that

opened the connection. SQL Server 2000 gets the user account information

from the trusted connection properties and matches them against the

Windows accounts defined as valid SQL Server 2000 logins. If SQL Server

2000 finds a match, it accepts the connection. When you connect to SQL

Server 2000 using Windows 2000 Authentication, your identification is

your Windows NT or Windows 2000 group or user account.

SQL Server 2000采用两种不同的验证方式:Windows验证和SQL Server 2000验证

用Windows验证连接时,不必指定一个用户ID及口令,连接验证使用Windows NT或2000的组帐号(group account)。
要知道:SQL Server 2000 在连接验证之前,用户先用Windows NT或2000的组帐号在客户端成功登录至SQL Server 2000服务器,方能建立一个信任连接(Trusted connection),SQL Server从信任连接属性中获取用户的帐号信息,将其与Windows已定义的帐号信息匹配和分析,如果正确就连接成功,并将此Windows帐号作为连接至SQL Server 2000的用户ID。

上文中的连接字中包含有:Trusted_Connection=yes;
这就意味着连接将采用信任连接方式,但由于连接前没有用Windows组帐号(在ASP环境中是访问IIS服务帐号IUSR_计算机名,在ASP.NET环境中帐号是ASPNET)登录至SQL Server 2000服务器, 也就是说没有建立一个信任连接(Trusted connection),当然,SQL Server 2000连接也不能够成功。

将Trusted_Connection=yes;删除或改为Trusted_Connection=no;
这将不采用信任连接方式(也即不采用Windows验证方式),而改由SQL Server 2000验证方式,即在连接字中指定:User ID=user name;Password=user password;
SQL Server 2000会将此用户ID和口令进行验证连接,而与Windows帐号无关。

关于SQL Server 2000上述两种验证方式的设置(连接验证采用Windows和SQL Server验证,还是仅采用Windows验证),可以启动SQL Server 2000企业管理器,然后在安全性配置中设置。


[聊天工具]企业邮件系统的利器----FoxMail Server  [系统软件]OPEN SERVER 5.0.5安装EXP300阵列柜
[系统软件]关于Windows2000Server的灾难恢复  [常用软件][网络]下载服务革命性风暴Poco Server评测
[C语言系列]动态创建SQL Server数据库、表、存储过程等架构信…  [C语言系列]SQL Server到DB2连接服务器的实现
[C语言系列]SQL Server到SYBASE连接服务器的实现  [C语言系列]SQL Server到SQLBASE连接服务器的实现
[C语言系列]SQL Server连接VFP数据库的实现  [C语言系列]ASP+SQL Server之图象数据处理
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Sql Server  · MySql
    · Access  · ORACLE
    · SyBase  · 其他
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台