简体   繁体   中英

What is the correct way to write server name for connecting a remote sql server?

In Visual Studio, I'm trying to connect to my staging db server.

In server name field, I've tried to fill with my server's ip address, but it didn't work.

I'm sure I've enabled access for the ip address in Sql Server configuration. My guess is that the server name was not properly set.

I've also tried myip/.SQLEXPRESS - also does not work.

Normal naming conventions for SQL Server used in Connection Strings:

http://www.connectionstrings.com/sql-server-2008

  • SERVERNAME, eg "myserver"
  • SERVERNAME\\INSTANCENAME, eg "myserver\\workgroup"
  • SERVERNAME,portnumber, eg "myserver,1999" if using non-standard ports
  • SERVERNAME\\INSTANCENAME,portnumber

In each case, SERVERNAME can be replaced with the IP address, if the servername will not resolve or just as an alternative, eg

  • 165.24.21.225\\SQLExpress,1999

In a connection string:

Driver={SQL Server Native Client 10.0};Server=165.24.21.225\SQLExpress,1999;Database=myDataBase;UID=mylogin;PWD=letmein;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM