0

Here's my connection string

Server=XXX.XXX.XXX.XXX\SQLExpress;Database=inspection;User Id=sa;Password=xxx;

I'm getting an error that it couldn't connect, but when I use connection string like this

Server=.\SQLExpress;Database=inspection;User Id=sa;Password=xxx;

it connects successfully, I don't know whats problem (the Ip is correct)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user3188370
  • 107
  • 1
  • 1
  • 7
  • This may be useful http://www.connectionstrings.com/sql-server-2008/ – Sajeetharan Apr 13 '14 at 19:00
  • SQL Server **Express** by default doesn't support remote connections - therefore using an IP address in your connection string won't work. Use `.` or `.\SQLEXPRESS` instead – marc_s Apr 13 '14 at 20:05

2 Answers2

0

If IP address is correct and you have firewall open and other stuff to be able to connect to this IP address, just try using it as is (i.e. without \SQLExpress part), so entServer=XXX.XXX.XXX.XXX;

dima
  • 1,181
  • 1
  • 9
  • 20
  • And configure sql express to listen to the IP address - default config on express IIRC is not to listen to the network externally ;) No TCP enabled. – TomTom Apr 13 '14 at 19:11
0

You may not have enabled the TCP/IP protocol in the SQL Server Configuration Manager, which I believe needs to be enabled for connections that aren't localhost (i.e. .) to succeed.

Martin Costello
  • 9,672
  • 5
  • 60
  • 72