无法将Sql Server连接到数据库使网络相关的错误 [英] Can't Connect Sql Server To the DataBase make Network Related Error

查看:102
本文介绍了无法将Sql Server连接到数据库使网络相关的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试连接sql服务器时,会出现类似与sql服务器建立连接时发生与网络相关或特定于实例的错误的错误.找不到服务器或无法访问该服务器.请验证实例名称是否正确.并且已将Sql Server配置为o允许远程连接.(提供者:Shared Memory Provider,错误:40-无法打开与Sql Server的连接((Microsoft Sql Server,错误:2)".最后一天工作正常.第二天我遇到这样的错误.

同样在Sql Server配置管理器中sql server服务已停止.当我尝试启动它时,会出现类似请求失败或服务未及时响应的错误.有关详细信息,请咨询事件日志或其他适用的错误日志".

那么错误是什么呢?提前谢谢

when i Try to connect sql server it makes error like "A network-related or instance-specific error occured while establishing a connection to sql sever.The server was not found or was not accessible.verify that the instance name is correct and that Sql Server is configured o allow remote connections.(provider:Shared Memory Provider,error:40-Could not open a connection to Sql Server( (Microsoft Sql Server ,Error:2)".last day it work fine.next day i got error like this.

also in Sql server Configuration manager sql server service stopped.when i try to start it make error like "the request failed or the service did not respond in a timely fashion.Consult the event log or other applicable error logs for details".

So what is the Error... Advance Thanks

推荐答案

要检查的东西:
1.确保您的数据库引擎已配置为接受远程连接
•开始>所有程序> SQL Server 2005>配置工具> SQL Server外围应用配置器
•单击服务和连接的外围应用配置"
•选择有问题的实例>数据库引擎远程连接
•启用本地和远程连接
•重新启动实例

2.检查SQL Server服务帐户
•如果您没有将域帐户用作服务帐户(例如,如果您正在使用NETWORK SERVICE),则可能需要先切换此帐户,然后再继续进行操作

3.如果使用的是命名SQL Server实例,请确保在ASweb P.NET应用程序的连接字符串中使用该实例名称. •通常,指定数据库服务器所需的格式为machinename \ instancename
•还检查您的连接字符串
Things to check:
1. Make sure your database engine is configured to accept remote connections
• Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
• Click on Surface Area Configuration for Services and Connections
• Select the instance that is having a problem > Database Engine > Remote Connections
• Enable local and remote connections
• Restart instance

2. Check the SQL Server service account
• If you are not using a domain account as a service account (for example if you are using NETWORK SERVICE), you may want to switch this first before proceeding

3. If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings in your ASweb P.NET application
• Usually the format needed to specify the database server is machinename\instancename
• Check your connection string as well
<connectionstrings>
<add name=""SampleConnectionString"" connectionstring=""Data" source="pashadkulkarni\myDB;Initial" catalog="TestDatabase;Integrated" security="SSPI;Min" pool="" size="5;Max" timeout="30″" providername=""System.Data.SqlClient"/">
</add></connectionstrings>


4.您可能需要在防火墙上为正在使用的SQL Server实例和端口创建一个例外
•开始>运行> Firewall.cpl
•单击例外"选项卡
•添加sqlservr.exe(通常位于C:\ Program Files(x86)\ Microsoft SQL Server \ MSSQL.x \ MSSQL \ Binn中)和端口(默认为1433)
•还检查您的连接字符串

5.如果使用的是命名的SQL Server实例,请确保在连接字符串中使用该实例名称.

6.检查SQLBrowser;检查它是否正在运行.您可能还需要在防火墙中为SQLBrowser创建一个例外.

7.检查您是否具有与SQL Server的连接.请注意您正在使用的连接方式:机器名称,域名或IP地址?检查连通性时使用此功能.例如,如果您使用的是myserver
•开始>运行> cmd
•netstat -ano | findstr 1433
•telnet myserver 1433
•ping -a myserver

检查正在返回哪些端口的IP地址.

替代:
如果仍然无法建立连接,则可能要在服务器上创建一个SQL帐户,在有问题的数据库上创建一个相应的SQL用户,然后在Web应用程序中使用此用户名/密码组合即可.

并查看 ^ ]


4.You may need to create an exception on the firewall for the SQL Server instance and port you are using
• Start > Run > Firewall.cpl
• Click on exceptions tab
• Add the sqlservr.exe (typically located in C:\Program Files (x86)\Microsoft SQL Server\MSSQL.x\MSSQL\Binn), and port (default is 1433)
• Check your connection string as well

5. If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings

6. Check SQLBrowser; check that it is running. You may also need to create an exception in your firewall for SQLBrowser.

7. Check that you have connectivity to the SQL Server. Note what you are using to connect: machine name, domain name or IP address? Use this when checking connectivity. For example if you are using myserver
• Start > Run > cmd
• netstat -ano| findstr 1433
• telnet myserver 1433
• ping -a myserver

Check what ports are IP addresses are being returned.

Alternative:
If you still can’t get any connection, you may want to create a SQL account on the server, a corresponding SQL user on the database in question, and just use this username/password combo in your web application.

And also have a look Here[^]


这篇关于无法将Sql Server连接到数据库使网络相关的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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