简体   繁体   English

如何连接到SQL Server 2008

[英]How to connect to SQL Server 2008

I have a desktop, and a Laptop. 我有一台台式机和一台笔记本电脑。 The Desktop has Windows 7 64-bit and the Laptop has Vista Ultimate 32-bit. 台式机具有Windows 7 64位,笔记本电脑具有Vista Ultimate 32位。 On both machines I have SQL Server 2008 Standard installed. 在两台计算机上,我都安装了SQL Server 2008 Standard。 On the laptop, I open SQL Management Studio and try to connect to the SQL Server on the desktop. 在笔记本电脑上,我打开SQL Management Studio,然后尝试连接到桌面上的SQL Server。 It times out. 超时了。

With SQL Server Config Manager I Enabled TCP/IP and Named Pipes for the client protocols. 使用SQL Server Config Manager,我为客户端协议启用了TCP / IP和命名管道。

In SQL Management Studio, I right clicked on the Database Engine, went to properties, and allowed remote connections. 在SQL Management Studio中,我右键单击数据库引擎,转到属性,并允许远程连接。 I also created a sql server login named "testuser" and a password. 我还创建了一个名为“ testuser”的SQL Server登录名和一个密码。 I then added that user as a login for my database and made them the database owner. 然后,我将该用户添加为数据库的登录名,并使其成为数据库所有者。

I could not figure out how to allow connection to my db throw the windows firewall, so I turned it off. 我不知道如何允许我的数据库连接抛出Windows防火墙,所以我将其关闭。

What am I missing? 我想念什么? I made the same changes on my laptop, and I can connect from the Desktop to the Laptop in Management Studio? 我在笔记本电脑上做了相同的更改,可以从台式机连接到Management Studio中的笔记本电脑吗?

Do you have a checklist? 你有清单吗? Thanks. 谢谢。

UPDATE: I turned off antivirus. 更新:我关闭了防病毒软件。 Ran NetStat -a and the listener is listening. 运行NetStat -a,并且侦听器正在侦听。

If your login attempt takes about 30 seconds to timeout, then it's some kind of network connectivity problem (or SQL isn't listening properly). 如果您的登录尝试超时大约需要30秒,则说明存在某种网络连接问题(或者SQL无法正确监听)。 A permissions problem would come back after a few seconds, so the long wait says it's connection-related. 几秒钟后就会出现权限问题,因此漫长的等待表明它与连接有关。

If you run "NETSTAT -a" on the server, so you see SQL Server listening on port 1433? 如果在服务器上运行“ NETSTAT -a”,那么您看到SQL Server在端口1433上侦听了吗? If not, then maybe the SQL TCP Listener isn't configured properly on the server - there should be events in the Windows Event log to this effect when the SQL Service starts up. 如果不是,则可能是服务器上的SQL TCP侦听器配置不正确-Windows事件日志中应该有一些事件会在SQL服务启动时达到这种效果。

Please edit your question with the results and we can go from there. 请使用结果编辑您的问题,我们可以从那里开始。

Try using Telnet to see if the laptop can see the desktop via port 1433. 尝试使用Telnet查看便携式计算机是否可以通过端口1433看到桌面。

Open a command prompt on the laptop and enter: 在笔记本电脑上打开命令提示符,然后输入:

telnet DesktopNameOrIPAddress 1433

Press Enter, and you should either see a connection failed error, or a blank screen. 按Enter键,您应该会看到连接失败错误或黑屏。 If you get the blank screen, the connection was established. 如果出现黑屏,则表明已建立连接。 Press CTRL-] to break out of it, then type "quit" and enter to quit. 按CTRL-]即可退出,然后键入“退出”并输入退出。

If the connection failed, attempt to resolve the general network issue with port 1433 before bothering to use the SQL Server tools. 如果连接失败,请尝试使用SQL Server工具解决端口1433的一般网络问题。

If you have any other anti-virus software running, it may also have a firewall built in. I know that McAfee does, for instance. 如果您正在运行任何其他防病毒软件,则可能还内置了防火墙。例如,我知道McAfee就是这样。 Check for that. 检查一下。

You've probably already thought of this, but have you checked that the server is configured to allow Mixed Mode Authentication? 您可能已经想到了这一点,但是是否检查服务器是否配置为允许混合模式身份验证? I have not had access to 2008, but I seem to remember that at least one of the previous versions was configured to disallow sql logins by default. 我没有访问2008的权限,但我似乎记得以前的版本中至少有一个默认配置为禁止sql登录。

I assume you already did what you have to do on the OS level. 我认为您已经在操作系统级别上做了必须要做的事情。 Or maybe tried to link the server to see if you can actually traverse your network. 或尝试链接服务器以查看您是否可以真正遍历网络。 Let me suggest a quick test. 让我建议快速测试。 Check if you can actually test connectivity by creating a Universal Data Link. 检查是否可以通过创建通用数据链接来实际测试连接性。 In case you don't know how to do this, create a new text file in your desktop (or anywhere) and change the .txt file extension to .udl; 如果您不知道如何执行此操作,请在桌面(或任何位置)中创建一个新的文本文件,然后将.txt文件扩展名更改为.udl; then just open it. 然后打开它。 See if your other server is "viewable" over the network (Don't forget to change the Provider to OLE DB Provider for SQL Server). 查看其他服务器在网络上是否“可见”(不要忘记将提供程序更改为SQL Server的OLE DB提供程序)。

Is the SQL Browser Service running on the server you are trying to access? 您试图访问的服务器上是否正在运行SQL Browser服务? (By default this is disabled, and you'll need that to access SQL Server remotely) (默认情况下,此功能处于禁用状态,您将需要远程访问SQL Server)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM