Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a web server (IIS7/.NET 3.5 native client) connecting to SQL 2005 through a firewall.

The server is on a cluster with a named instance configured to respond to the static port 1089.

TCP ports 1433 and 1089 are open on the firewall, UDP port 1434 is open as well.

Once the connection is estabilished, the setup is really fast (~10ms per query), however setting up the first connection takes 37 seconds!

The connection string being used is the following:

Data Source=1.2.3.4,1098;Network Library=DBMSSOCN;Initial Catalog=MyDatabase;user id=my_user_id;password=secret_stuff

The web server and the sql server are on different domains. However, I am using SQL Authentication.

If I connect from a normal client machine everything works like a charm.

Has anybody encountered this problem before? How could I solve it or at least investigate the issue further?

share|improve this question
    
Have you tried looking at what is happening on the network with a packet sniffer like wireshark? It might be waiting for something else to occur, like a timeout for authentication, before connecting properly. –  Sim Feb 11 '10 at 11:54
    
I can't install wireshark on a live server and this does not happen on the test setup... It was my first thought too. –  Ebenezer Sklivvze Feb 11 '10 at 12:29

2 Answers 2

up vote 1 down vote accepted

Looks like it's trying to do a reverse DNS on the 1.2.3.4 address for some reason, possibly an IIS setting but it might be something else. If you add a hosts entry to c:\windows\system32\drivers\etc\hosts for the SQL server name does it make a difference?

If that doesn't help or you just want to be able to figure out what's going on in situations like this in general you should use a network\packet analyser. Windows Network Monitor or WireShark will both do the trick in your case. These aren't trivial tools to use but if you capture a session that exhibits your problem you should be able to see what traffic immediately preceeds they long delay and with any luck be able to zero in on the root cause.

share|improve this answer
    
Thanks, very useful... I need 15 rep to vote you up otherwise I would have. I don't want to install the shark on a live web server (bacuse of libpcap), but at least I might try the microsoft one if it's less invasive. I'll try the hosts solution presently. –  Ebenezer Sklivvze Feb 11 '10 at 12:28
1  
It's not a DNS lookup, the IP is actually in the available DNS and putting it in the hosts file didn't do any good... –  Ebenezer Sklivvze Feb 11 '10 at 12:43

In the question you said "I am using SQL Authentication", however if the server is setup to allow both integrated and SQL authentication, it may be trying to do a domain lookup.

Check the security event viewer on the server and look for failure events for authentication

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.