无法连接到 SQL SERVER 2000 [英] Cannot connect to SQL SERVER 2000

查看:39
本文介绍了无法连接到 SQL SERVER 2000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 php 5.3.1 连接到远程机器上的 SQL SERVER 2000.我使用 Windows XP.使用这样的简单程序:

I am using php 5.3.1 to connect to my SQL SERVER 2000 on remote machine. I use Windows XP. On using simple program like this:

$conn = mssql_connect("VBNET","sa","mypass") or die ( 'Can not connect to server' );

我收到以下错误:

警告:mssql_connect() [function.mssql-connect]:消息:用户sa"登录失败.原因:未与受信任的 SQL Server 连接关联.(严重性 14)在 C:\wamp\www\Mssql\test.php 第 8 行

Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in C:\wamp\www\Mssql\test.php on line 8

警告:mssql_connect() [function.mssql-connect]:无法连接到服务器:第 8 行 C:\wamp\www\Mssql\test.php 中的 VBNET无法连接到服务器

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: VBNET in C:\wamp\www\Mssql\test.php on line 8 Can not connect to server

我在我的 SQL SERVER 中启用了 TCP/IP 和命名管道并重新启动了它.其身份验证也设置为混合模式身份验证.

I enabled TCP/IP and named pipes in my SQL SERVER and restarted it. Also its Authentication is set to Mixed Mode Authentication.

我可以通过 MS SQL Server Management Studio 看到我的服务器.那么我在这里错过了什么?

I can see my server through MS SQL Server Management Studio. So what am I missing here ?

提前致谢.

附言我在 SQL SERVER 2008 中有另一台服务器,我可以使用上述相同的连接字符串轻松连接到该服务器.

P.S. I have another server in SQL SERVER 2008 to which I can easily connect with the same above mentioned connection string.

根据这篇文章,我在 cmd 中启动了 sqlcmd -S np:\\VBNET\pipe\sql\query -U sa 并输入了密码,然后就成功了!!!那么现在可能是什么问题.我不知所措...请帮忙!!

According to this post, I fired sqlcmd -S np:\\VBNET\pipe\sql\query -U sa in cmd and entered the password and that worked !!! So now what could be the problem. I am at my wits end...please help !!

推荐答案

如果您可以使用 SSMS 进行连接,那么请准确复制连接,即确保您指定了一个命名实例(例如VBNET\SQLSERVER").打开 SSMS,在左侧的服务器节点上右键单击并选择属性".

If you can connect using SSMS, then copy the connection exactly, i.e. make sure you specify a named instance (e.g. 'VBNET\SQLSERVER'). Open SSMS, on the server node on the left side right click and select 'Properties'.

如果您在同一台机器上运行 SQL 2008,则很可能 SQL 2008 使用默认实例,而 SQL 2000 使用命名实例.

If you have SQL 2008 running on the same machine it is most likely that SQL 2008 uses the default instance and SQL 2000 a named instance.

还有什么可以帮助,即让测试更简单的是创建一个空的 UDL 文件(例如TEST.UDL").一个空的文本文件应该可以.然后双击它,选择提供商并进行设置.您始终可以使用测试连接"按钮来测试连接.当我第一次必须从客户 PC 连接时,我会使用这个技巧.

What also could help, i.e. make testing simpler is to create an empty UDL file (e.g. 'TEST.UDL'). An empty text file should do. Then double click on it, select the provider and play around with the settings. You can always test the connection using the 'Test connection' button. I use this trick when I have to connect from a customer PC for the first time.

这篇关于无法连接到 SQL SERVER 2000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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