Bob Beauchemin helped me out with a little problem I was having yesterday, and I figured I'd do my part to disseminate the information.
I was playing around with some software that needs a database back-end. All I have on my machine right now is some interim build of Yukon that we're using at MSDN. I knew I was risking problems by using it, but I didn't really want to have to install SQL Server 2000 as well.
The problem I ran into was when using a connection string like this:
server=.\saratoga;database=MSDNPreview;uid=blah;pwd=foobar
I was getting the following error message
SQL Server does not exist or access denied.
After playing around with it for a while, I discovered that if I ran the program I was testing from a window where it bound to Whidbey, the error message went away. In other words, the problem only existed when using System.Data.SqlClient from the CLR 1.1. I thought I was running into a bug in Yukon that meant I was going to have to install SQL Server 2000. Sigh.
Fortunately, before I went down that road, I asked some of my DM buddies if they knew of this particular issue. Bob came back and said that he'd seen this error before, and that for him, switching the connection string to something like this:
server=localhost\saratoga;database=MSDNPreview;uid=blah;pwd=foobar
fixed the problem (note the use of 'localhost' instead of '.').
And sure enough - it fixed it for me, too. Thanks Bob!
Doesn't that force the SQL libs to use tcp/ip rather than a named pipe? Maybe the error had something to do with permissions?
ReplyDeleteJ
It may well be that it forces it to TCP/IP, but I don't think that was it. I tried using "net=dbmsscp" (or whatever the syntax is - I looked it up) to force a TCP/IP connection, and still got the same error. So while specifying localhost may *also* have changed it to use TCP/IP, *nothing* was working with '.', so I didn't have much choice.
ReplyDeleteJust FYI, it looks like it's a MS bug (but their suggestion is that you try changing the connection library as well:
ReplyDeletehttp://support.microsoft.com/default.aspx?kbid=315159
I was able to replicate this problem even when not running under ASP.NET. Further, as I said, changing the protocol library didn't suppress the bug. So I think it's something other than what's outlined in this KB article, but it's still a good resource for people having that same error message, so thanks for posting it.
ReplyDeleteMan you ROCK!!! this works, and it's easy! for me it only wanted the server name though. server=servername
ReplyDeleteGlad I could help, but Bob is the real person to thank.
ReplyDeleteUm, the blog entry *does* explain the problem and how to solve it.
ReplyDelete"SQL Server does not exist or access denied" Give in conncet to ASP.NET to sql but sql will work good with ASP
ReplyDeleteSQL Server does not exist or access denied" Give in conncet to ASP.NET to sql but sql will work good with ASP
ReplyDeleteContactYour DBA or your .Net Faculties for this problem.
ReplyDeleteHello Amit Remove your SQL-Server and contact your system administrator to reinstall it.
ReplyDeleteThanks for the info below, very helpful. HOWEVER, I do try to remove the 'localhost' thing and put only the sql server name (either local or remote) and it works just fine as long as you are in the network.
ReplyDeleteI.e., in your case:
server=saratoga;database=MSDNPreview;uid=blah;pwd=foobar
(NOTE: notice I don't even put '.\' or 'localhost\')
Check the password in the Services for MSSQLServer. It maybe keeping the old password after you changed in the network password.
ReplyDeleteI get the message "SQL Server does not exist or access denied" when using the openquery function to connect to a database in SQL Server 2000. What can I do to fix this?
ReplyDeleteThanks,
Ben
This message is coming when login to sqlserver. what to do???
ReplyDeleteI am having the Same Problem , Any one has a solid solution ?
ReplyDeletei am having the same problem,any one has correct solution?
ReplyDeleteWhen i try to connect sql server then i give messege access denied
ReplyDeleteI have sqlserver 2000 pro.and .net 2003 with OS XP-service pack-2 but when I am trying to establish the connection with sqlserver from localhost through asp.net web application. I got message sqlserver does not exist whenever my code is right becouse same code running on other system.
ReplyDeleteSimplest Solution is Remove Your Lan Cable and Plug-In Again
ReplyDeleteUse this security patch from MS - <BR>http://www.microsoft.com/downloads/details.aspx?familyid=9552d43b-04eb-4af9-9e24-6cde4d933600&displaylang=en
ReplyDeleteif i run my web page i'm getting the problem like this:
ReplyDelete"SQL Server does not exist or access denied"
already i've given connection string like this:
"server=jmj\\begsql;uid=sa;pwd=something;database=victoria_wfms"
then,why is this problem i'm getting.
plz guide me.
thanks,
victoria.
Hi,
ReplyDeleteI've having the same trouble, the issue was, my Avast Server Edition has been expired, so it just block some protocols, in some few computers didn't connect using TCP/IP and also some others didn't connect using the PIPE Server name. Only by removing the Avast Antivirus from the server was the solution.
Hope it can help you some one.
Regards
I have tested all your suggestions , but still the error is coming , Iam using dotnet 2002, sql server 7 in OS windows XP Professional.
ReplyDeletewhat to do? The problem is that it is connecting with remote db server but not with the loacal db server
Here is the Code.
con = New SqlConnection("server=server;user id=sa;password=pwd;initial catalog=master")
i have also same problem.i'm useing sql server 2005 please help me.
ReplyDeleteIwas facing similar kind of problem. I got multile sites on same IIS server and SQL 2000 server. only for one saite it was giving this error. Rest were working fine. Then I rerstarted only the affected website and it started working smothely
ReplyDeleteI had the same problem that troubled me almost two days. None of the things on the internet worked, until I got round it completely by accident.
ReplyDeleteCause of the problem was
data source = local
Solution
data source =(local) or .
Hope this will help some, if not all
i cant fix my problem. I tried all those steps but even its telling Sql server doesnot exist or access denied
ReplyDeleteI have .net 2003 and sql 2005 in my machine and trying to connect sql 2005 in [remote machine].
ReplyDeletewhile trying to connect using query analyzer it is connecting. but when i try to connect using connection string it is getting error
"SQL Server does not exist or access denied"