如何在远程服务器上使用SQL Server数据库 [英] How to use Sql server database on remote server

查看:195
本文介绍了如何在远程服务器上使用SQL Server数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个使用sql server 2005数据库的asp.net应用程序,它可以在localhost上运行,但是当我在远程服务器数据库上运行时使用.请有人建议我该怎么做

预先谢谢您.

Hi Guys,

I have a asp.net application using sql server 2005 database it run on localhost fine but when i used on remote server database working. plz any one suggest me what to do

Thank you in advance.

推荐答案

要做的第一件事是尝试通过Server Explorer窗口使用SQL Server Management Studio或VS连接到远程数据库.如果可以执行此操作,则属性窗格可以显示适用于该服务器实例和数据库的连接字符串.

如果不是,那么您需要查看任何错误消息-它们可能会有所帮助.
可能是防火墙问题,可能是未将远程数据库配置为接受远程连接.
使用您提供的信息,如果很难提供更准确的答案.
The first thing to do is try to connect to the remote database using either SQL Server Management studio or VS via the Server explorer window. If you can do this, then the properties pane can show you the connection string which will work to that server instance and database.

If it doesn''t, then you need to look at any error messages - they may help.
It could be a firewall problem, it could be that the remote database is not configured to accept remote connections.
With the info you have given, a more accurate answer if very difficult to give.


连接到远程服务器中的数据库时,必须检查它是否提供了用于连接的远程端口,如果因此您还必须将端口添加到连接字符串中.

参见示例

<添加名称="ConnectionString" connectionstring =数据源= [IP/服务器名称],[RemotePort];初始目录= [DBName];持久安全信息=真实;用户ID = [用户名];密码= [密码]" providername ="System.Data.SqlClient"/>
While connecting to database in a remote server you have to check whether it provides a remote port for connection, if so you have to add the port also to the connection string.

See the example

<add name="ConnectionString" connectionstring="Data Source=[IP/ServerName],[RemotePort];Initial Catalog=[DBName];Persist Security Info=True;User ID=[username];Password=[password]" providername="System.Data.SqlClient" />


这篇关于如何在远程服务器上使用SQL Server数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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