views:

227

answers:

5

I have a Windows 6 app I am developing (in VB). I am pulling data from a MSSQL 2005 database. Everything worked fine running it locally (with an emulator) but when I moved the database to a test box, I get the following error:

System.Data.SqlClient.SqlException {"Specified SQL server not found: xx.xx.xx.xxx\sql2005"}

My connection string is:

Data Source=XX.XX.XX.XXX\sql2005;Initial Catalog=databaseName;UID=databaseUser;PWD=password

The only difference in the connection string from when I was running it locally is I used my computer name (which I also tried using the name of the sqlserver computer).

Thanks

+2  A: 

make sure sql browser is running

make sure remote connections and TCP/IP is enabled on the SQL box

SQLMenace
and make sure the instance is named sql2005
Joel Coehoorn
Yes, I've checked the SQL box and the instance is named sql2005.
monkeypushbutton
A: 

Is the app running on the same server as the DB? Have you tried using "localhost"?

notnot
+1  A: 

Try changing your connection string to:

Data Source=XX.XX.XX.XXX;Initial Catalog=databaseName;UID=databaseUser;PWD=password

Most likely the Instance Name (sql2005) is incorrect.

Gordon Bell
This was close. See my full comment below.
monkeypushbutton
A: 

Definitely look to make sure that remote connections are enabled on the SQL Box as SqlMenace suggested.

If SQL Server is configured to allow remote connections & TCP/IP is enabled, try running the app on the database server to see if it works correctly. If it doesn't work, it would indicate that there is something wrong with the connection string.

If running the app locally on the database server works, and remote connections \ TCP/IP are enabled, try this article concerning Windows Firewall and SQL Server.

Tim Lentine
+1  A: 

Gordon's idea was close. The instance name (sql2005) was correct, as I could get there with the same connection string from a web app of mine, but for some reason wouldn't work with the mobile app. When I moved the database from that instance onto just that box (so xx.xx.xx.xxx with no /sql2005) it worked.

monkeypushbutton