How to connect to SQL server through IP

偶尔善良 提交于 2019-12-25 01:27:06

问题


I have a remote server that has win2003 installed

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

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

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


回答1:


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:

  • 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.



回答2:


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




回答3:


Here's a sample connection ADO.net connection.

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()



回答4:


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

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.



来源:https://stackoverflow.com/questions/1352661/how-to-connect-to-sql-server-through-ip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!