Adsense

Monday, January 21, 2008

"Error: SQL Server does not exist or access denied" - SQL Server 2005 - .Net 1.1 - Specifying ip,port

I recently picked up a project that was written using Visual Studio 2003 and .Net 1.1. The application connects to a SQL Server 2005 database, and I didn't have the connection string that was used previously and had to create my own. I added a ConnectionString key to the appSettings section of my App.config, and fired her up. The connection string pointed to a freshly generated copy of the database needed for the application. After a few seconds, I was presented with the following error "Error: SQL Server does not exist or access denied". Joy.

Because this error is so generic, there is a lot of information returned by Googling the message. Unfortunately there are a million things that might be the cause. I couldn't find a solution online, but ended up finding a fix for my specific situation.

If you are working with a project created using .Net Framework version 1.1, against a SQL Server 2005 DB, and trying to connect without specifying the ip and port of your db engined, you might get this error. What you might want to try is to replace your "data source" with the "ip,port" of your db engine and see if it fixes your issue.

OLD/Broken: <add key="ConnectionString" value="data source=.; initial catalog=YourDB; user id=YourUsr; password=YourPwd;" />

NEW/Working: <add key="ConnectionString" value="data source=127.0.0.1,1433; initial catalog=YourDB; user id=YourUsr; password=YourPwd;" />

Just one more thing to try when dealing with this very generic Error Message.

2 comments:

Anonymous said...

thank you, i got this error message.
i'll try it first. :)

gjdfgwer said...

Thank you! You are a life saver!