远程 SQL 服务器的连接字符串
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9262412/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Connection string for a remote SQL server
提问by Laziale
I am trying to connect to a remote SQL server. I would like to know the proper way to connect to the server. TCP/IP protocol is enabled. I am trying this way:
我正在尝试连接到远程 SQL 服务器。我想知道连接到服务器的正确方法。TCP/IP 协议已启用。我正在尝试这种方式:
@"Server=myserver.com\SQLEXPRESS; Database=mydatabase; User ID=user; password=pass"
I am using myserver.com
to connect to the server via RDP and I can connect without any problems, but when I am using the combination above to connect
to the SQL server via my code, it says that the server can't be found or does not exist.
我正在使用myserver.com
通过 RDP 连接到服务器,我可以毫无问题地连接,但是当我使用上面的组合通过我的代码连接到 SQL 服务器时,它说服务器找不到或不存在.
Am I doing something wrong?
难道我做错了什么?
回答by Michael Brown
May I introduce you to http://www.connectionstrings.comwhenever I have to manually create a connection string that's my first port of call. I can tell you right now that you can't do SQLExpress from a remote client (at least not the last time I checked). But hereis the page for SQL Server connection strings. If it works, then it'll be there
每当我必须手动创建连接字符串时,我可以向您介绍http://www.connectionstrings.com,这是我的第一个呼叫端口。我现在可以告诉您,您不能从远程客户端执行 SQLExpress(至少我上次检查时不是这样)。但这里是 SQL Server 连接字符串的页面。如果它有效,那么它就会在那里
EditIt looks like you canconnect remotely. It's just not configured that way out of the box
编辑看起来您可以远程连接。它只是没有开箱即用的配置