windows 如何通过IP连接到SQL服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1352661/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:03:53  来源:igfitidea点击:

How to connect to SQL server through IP

sqlwindowswindows-server-2003

提问by kaivalya

I have a remote server that has win2003 installed

我有一个安装了 win2003 的远程服务器

I can connect to the machine using remote desktop and am succesfully hosting a web app on the server

我可以使用远程桌面连接到机器,并成功地在服务器上托管了一个 Web 应用程序

I need to connect to the SQL server on that machine using a sql compare tool that I have.

我需要使用我拥有的 sql 比较工具连接到该机器上的 SQL 服务器。

What are the steps that I need to take to be able to connect to the SQL server given that all I have is the IP address to the machine and admin login credentials

鉴于我所拥有的只是机器的 IP 地址和管理员登录凭据,我需要采取哪些步骤才能连接到 SQL 服务器

回答by mson

if you are trying to remotely connect to sql server using ssms or another client on a different machine, you need to do the following:

如果您尝试使用 ssms 或另一台机器上的其他客户端远程连接到 sql server,则需要执行以下操作:

  • open up sqlservr on server firewall
  • open up sqlbrowsr on server firewall
  • be concerned about security - if you can rdp/connect to sql w/o vpn, then so can other people - so you better make sure you have hardened environment and very strong passwords.
  • 在服务器防火墙上打开 sqlservr
  • 在服务器防火墙上打开 sqlbrowsr
  • 关注安全性 - 如果您可以 rdp/connect to sql w/o vpn,那么其他人也可以 - 所以你最好确保你有强化的环境和非常强的密码。

回答by Martin v. L?wis

Depending on the specific access technology, different syntaxes for connection strings are needed. For the .NET provider, the syntaxallows for passing server addresses.

根据具体的访问技术,连接字符串需要不同的语法。对于 .NET 提供程序,语法允许传递服务器地址。

回答by Rob

Here's a sample connection ADO.net connection.

这是一个示例连接 ADO.net 连接。

imports System.Data.SqlConnection
...
dim cn as new SqlConnection()
cn.connectionString = "Server=192.168.1.200;Database=mydbName;user id=notSA;password=C0mp!3xPVVD"
cn.open()
...
'Do cool stuff
...
cn.close()

回答by PostMan

Open up port TCP 1433 (Sql Server) on the remote server And for your connection string jus use the IP Address for the Server, instead of using the computer name

在远程服务器上打开端口 TCP 1433 (Sql Server) 对于您的连接字符串,请使用服务器的 IP 地址,而不是使用计算机名称

You should be able to interchange between computer name and IP address without any problems, because the Computer Name gets turned into an IP Address anyway.

您应该能够毫无问题地在计算机名和 IP 地址之间进行交换,因为无论如何计算机名都会变成 IP 地址。