无法连接到远程数据库 [英] Not able to connect to remote database

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

问题描述

我已经将应用程序托管在服务器上,还购买了Web服务器上的空间.但是我无法尝试连接数据库.使用SQL Server Management Studio 2008,我可以轻松地连接和访问数据库
每当我收到此错误时:
建立与SQL Server的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称正确,并且已将SQL Server配置为允许远程连接. (提供者:SQL网络接口,错误:26-查找指定的服务器/实例时出错)
我正在使用的连接字符串字符串如下:

I have hosted my application on a server and also purchased space on web server.But I am not able to try to connect with my database. And using SQL server management studio 2008 I can easily connect and access my database
Every time I get this error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
My connection string string I am using is given below:

connectionString="Server=***.**.***.***;Initial Catalog=xyz;User ID=abcd;Password=abcd"


我已经与托管服务提供商进行了互动,因为他们正在使用某些端口号或实例名称,但是他们拒绝了.他们告诉我所有连接都在1433端口打开.
然后,我尝试使用此连接字符串:


I have interacted with hosting provider as they are using some port number or instance name but they say no. They told me that all connection are open at port 1433.
Then I tried with this connection string:

connectionString="Server=***.**.***.***,1433;Initial Catalog=xyz;User ID=abcd;Password=abcd"


但是同样的错误/异常.


But same error/exception.

推荐答案

检查这些内容
1.确保您的数据库引擎已配置为接受远程连接(我正在使用集中式数据库)
•开始>所有程序> SQL Server 2005>配置工具> SQL Server外围应用配置器
•单击服务和连接的外围应用配置"
•选择出现问题的实例>数据库引擎远程连接
•启用本地和远程连接
•重新启动实例

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

3.如果使用的是命名的SQL Server实例,请确保在ASweb P.NET应用程序的连接字符串中使用该实例名称. •通常,指定数据库服务器所需的格式为machinename \ instancename
•还要检查您的连接字符串




您可以尝试以下步骤
check these things
1. Make sure your database engine is configured to accept remote connections(I you are using centralized database)
•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


or

you can try these steps
For connectivity in visual studio 
open Server Explorer
right click add Connection
Follow simple steps
After Creating Connection Right click on Database//Solve error if any
Click on properties
In Proprties Connection String will be found.
Copy This String.


尝试此引用

http://www.connectionstrings.com/
try this reference

http://www.connectionstrings.com/


完全同意Uma Shankar Patel"的解决方案.但是,如果您仍然遇到相同的问题,请尝试在远程连接"下选择同时使用TCP/IP和命名管道.

重新启动服务并检查.并检查防火墙中的任何端口设置.
Completely agree with Uma Shankar Patel''s solution. But still if you have the same problem please try selecting Using both TCP/IP and named pipes under Remote Connections.

restart the service and check. And also check any port setting in firewall.


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

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