SQL 2005 札记 (1) -- SQL 2005 远程连接的问题

Posted on 2007-02-06 10:36  Vitoria  阅读(12913)  评论(9编辑  收藏  举报

        SQL Server 2005 使用得有阵子了,写些笔记,好记性不如烂笔头.

        安装就不用说了,Google自然是可以找到相当全面的安装教程的. 只说些远程连接的问题,因为自己也实在是被这些诡异的问题困扰了很久的.

        问题描述:

        服务器机器配置: Windows XP SP2 + SQL Server 2005开发版 SP1

        客户端用SQL Server Management Studio连接服务器的SQL Server 2005 时,提示连接不上.

        错误信息: An error has occurred while establishing a connection to the server. When connecting to SQL Server allow remote connections.(provider: SQL Network Interfaces, error:26-Error Locating Server/Instance Sepcified)(Microsoft SQL Server)

        解决办法:

        1. 确保服务器端的数据库中存在sa,并支持混合登录模式.默认安装的时候,可能会忽略建立sa.

        2. 确保服务器端的数据库是支持远程调用的.打开SQL Server Management Studio,选择该数据库,右键菜单"Properties",在打开的对话框中选择Connections,把Allow remote connections to this server选上.

       

        3. 确保服务器端的SQL服务的TCP/IP是Enable的.打开SQL Server Configuration Manager. 选择SQL Server 2005 Network Configuration下的Protocols for SQL2005( 我安装的SQL示例名为SQL2005), 把Named Pipes和TCP/IP都修改为Enabled,默认是Disabled.

      

       4. 确保服务器端的SQL实例的远程调用是支持TIP/IP和named pipes的. 打开SQL Server Surface Area Configuration Manager,在打开的页面中选择Surface Area Configuration for Services and Connections.选中实例的Remote Connections,把Using both TCP/IP and named pipes选中.

      

        5. 重启服务器端的SQL Server 2005服务,确保SQL Server Agent和SQL Server Browser的服务也启动了. 默认都是需要手动启动,可以改成Automatic.

       

        6. 因为服务器端的操作系统是WinXp+SP2,所以还需要检查防火墙.确保防火墙中的1433端口打开了.

        另外, SQL Server 2005的默认端口可能不是1433. 我们需要手动修改一下. 打开SQL Server Configuration Manager. 选择SQL Server 2005 Network Configuration下的Protocols for SQL2005( 我安装的SQL示例名为SQL2005), 查看TCP/IP的属性.在打开的对话框中选择IP Address, 把到IPAll下的TCP Dymanic Ports和TCP Port的值修改为1433.

       

       在Windows防火墙中的Exceptions中Add Port:TCP 1433和UDP 1434, 同时还需要Add Program.先打开SQL Server Configuration Manager,在SQL Server 2005 Services中选中SQL Server,查看属性,在Advanced中记下Instance ID.如(MSSQL.1)

       

       在防火墙的Exceptions中Add Program,找到诸如...\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe,添加.

       

        所有这些都做完了,客户端应该就可以访问了,最好客户端也在自己的Configration Manager的Client Configuration中设置TCP/IP为Enabled.

 

       本文参考了

       Microsoft的"如何配置 SQL Server 2005 以允许远程连接" http://support.microsoft.com/kb/914277

       维生素C.NET的SQL Server 2005 Remote Access (http://lovewangshu.cnblogs.com/archive/2005/12/01/288815.html)

       CSDN上一篇帖子(http://community.csdn.net/Expert/TopicView3.asp?id=4748358 )

       和其他众多从Google上找来的文章, 一并谢之

Copyright © 2024 Vitoria
Powered by .NET 8.0 on Kubernetes