Tuesday, October 21, 2008

SQL Server Not Found or Does not exist while creating DSN

Today I came across this issue reported by a user while installing CITRIX Presentation Server.


CITRIX connects to SQL Server using SQL DSN which uses ODBC Driver and already SQL Server 2005 Standard Edition was installed in the DB Server which is a named instance. Assume that the Named Instance is citrix-sql\presentation. Now when he is typing this instance name while creating DSN and clicking Next he is facing the error "SQL Server Not Found" and sometimes "SQL Server Does not Exist of Access denied". By default CITRIX creates DSN by name MF20.DSN.


I got call on this and i tried below steps
  • Connecting to default instance in the dsn, It worked!

  • Connecting to same named instance by specifying port number (Ex:4434), It worked!

  • Enable Named Pipe for Remote Connections in the SQL Server and changed the client configuration while creating DSN to use Named Pipe as protocol, It worked!

Then I came to conclusion that this application server when trying to communicate to SQL Browser Server in the remote SQL Server it is not getting proper response

What to do to figure out this?

Download PortQry.exe from Microsoft using this link and go to command prompt from the application server from where you are not able to connect to SQL Server and type below command

portqy -n {WindowsHostNameof SQL Server Here} 1434

Now if you get result like below then connectivity through UDP to 1434 port is FILTERED or BLOCKED so ask your network team to release the port block in Firewall/Antivirus!


Once the blocking in removed then you will get below result which will get the instance name and SQL Server version and now connectivity will be fine!
So Why SQL Browser Service is needed here? What is 1434?
Are these your doubts? then you should understand how connectivity is established when some client make request!
1. Clients will send a request to the specified SQL Server through UDP in port 1434 asking for port number in which SQL Server is listening.
2. Now on the SQL Server side, SQL Browser service will be listening on UDP 1434 and as soon as request comes, It will read the port number from the registry and reply back to the client.
3. Now the clien will initiate connection using that port!

So that's why when we try specifying the port manually it is working also Named Pipe is also working. Also it works for default instance because it will listen on port 1433 which is SQL Server's Standard port!

I'm sure that this article will help you to completely resolve the issue of connecting to Named Instance not working but Default instance through TCP IP and using Named Pipe works... Put your comments!

No comments:

Post a Comment

Please do not spam!