SQL SERVER connectivity error: SQL Server does not exist or access denied

Recently I was troubleshooting a connectivity issue in a development environment from an application. The application was using the connection string as

“Provider=sqloledb;Data Source=myserver\instance1,1433;Network=DBMSSOCN;Initial Catalog=mydb;Integrated Security=SSPI;”

I was able to connect to the SQL SERVER from SSMS, however when connecting from an application it was throwing the error

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied

This is very generic one and can happen due to many reasons like

(1) Account may not have access or password might be wrong
(2) Connection might be blocked by a firewall
(3) Since it is a named instance, the port might be different. In some cases it might be dynamic also, for which the SQL Server Browser service should be up and running.

Looking at the connection string, everything looked good except for the “Network”. I had no idea of what it is. Googling led me to this KB article from Microsoft which clearly explains what it is.

Basically when an application is trying to connect to SQL SERVER, if one protocol fails then it tries to connect with another protocol. Example, assuming TCP/IP is enabled as primary and Named Pipes as secondary. When an application tries to connect to SQL SERVER, it first tries with TCP/IP. If that did not succeed, it tries with Named Pipes. If that also fails, then only it throws the error.

However, we can force the application to use only one protocol and that is done by the “Network” keyword in the connection string. This article defines all the options available for “Network”.

In my case the option “DBMSSOCN” corresponds to TCP/IP and it was disabled in the development machine. Enabling it, using this article, fixed the issue.


About Suresh Kumar D

Hardcore SQL Developer and aspiring Database Architect.
This entry was posted in SQL SERVER. Bookmark the permalink.

5 Responses to SQL SERVER connectivity error: SQL Server does not exist or access denied

  1. Prosper says:

    Thanks for the hint, I was unable to access the SQL Server instance on the remote PCs, but I am able to do that now, but when I’m trying to use the remote computers to access the Database Name, I get the following error

    “Unable to connect to server “PastelServer\SQLEXPRESS”. Reason:[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

    I don’t know what else that could be the problem.

    Please Assist, thanks.

  2. Duarte says:

    Thanks for the hint.

    In my case i define alias in both 32 and 64 bits, and after that was not necessary to indicate port number.

  3. Polelo says:

    Thanks for the post. My named Pipe was disabled.

  4. John Walker says:

    Sometimes this error message occurs because the port id is not added in the exception list, so to fix the error you need to check that the post exception is added to the firewall. For reference: http://www.sqlserverlogexplorer.com/database-does-not-exist-access-denied/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s