SQL Server does not exist or access denied

The error message in this case is very likely correct. First, verify that the network path from you to the new server works and you can connect with the specified userid/pwd.

1) Open Management Studio and attempt to connect to the SQL Server instance by ip address. (By the way, you will probably need to use a SQL Server userid/pwd if you aren't already since you're on an Internet host and there is very likely no AD context for Windows auth.)

2) If you can indeed connect to the instance and your database using Management Studio then you've probably missed a connection string somewhere. Try to maintain only 1 location for said connection string, usually in a config file. Examine the error line reported in detail to discover which connectionstring is being used and to verify that it reflects the new server ip.


Check your TCP/IP Port is enabled or not

To check it:

-- Open SQL Server Configuration Manager from start program.
-- Expand SQL Server Network Configuration
-- Click on Protocols for XXXX
-- Right Click on TCP/IP and open properties
   - Enable TCP/IP
   - In IP Address Tab, Set Port 1433 in the last option (IPAll)


This same error also occurs when a cloned server's IP is not configured correctly in SQL Config --> TCP/IP connection.

With misconfigured IP in SQL TCP/IP config does let you:

  1. connect from client machine using server name using ODBC connection
  2. connect using TELNET with 1433 port number with sever name

This happens when the server is cloned from another SQL server which carries the SQL IP config from the primary server as residue.

But client applications fail to connect using connection strings though using the server name with the following message:

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

Do the following to verify on the SQL Server:

  1. Note the IP of the server itself (probably admins updated the machine's IP after cloning the box) by doing IPCONFIG
  2. Open SQL Server Configuration Manager
  3. Expand SQL Server Network Configuration
  4. Select Protocols for MSSQLSERVER
  5. Double click TCP/IP on the right
  6. Switch to IP Addresses tab
  7. Scroll down to IPv4 section to verify if it is the same as the IP address of the machine itself. Fix the IP, if it is not. If it is correct this is not the issue.

I experienced this issue as well when setting up an installation on a new computer.

The connection problem I experienced was due to a firewall setting on the server that hosts MSSQL. The setting gave individual IP addresses access to it which 'works' in our environment since IP addresses are described by our administrator as 'sticky'. Once the Firewall access was granted to my new machine's IP address, the PHP odbc_connect(...) statement I was running in my local WAMP setup completed immediately.

As with many problems, there is probably more than one way to run into them, but I wanted to be as explicit as possible about how I experienced it.

This probably would have been a little more clear if I had my own installation of MSSQL management studio on my PC but I do not.

Of the Inbound rules on the server housing MSSQL, I found a rule referring to the MSSQL instance and sure enough found the IP address of my old machine there underneath the properties tab "Scope" as a "Remote IP address". Here's to hoping I remember this whenever I get my next machine! (The decommissioned PC's IP has been removed)

@Darren, if you could leave a comment under the answer you accepted, it might be nice to know which of @Tahbaza's suggestions led you to your resolution.

Tags:

Sql

Sql Server