Brent Stewart

Live life on purpose

Debugging wierd SQL connection issue

I had a strange SQL server connection issue the other day, and I thought I would document it.  I started working at a new client's site and needed to connect to their SQL server.  At first everything seemed to work fine, but after I left the connection idle for a while I would lose the connection and could only reconnect if I rebooted my machine.  After struggling with the problem for a couple of days I discovered I could reset my network adapter a few times and be able to reconnect to the server.  After getting tired of jumping through these hoops just to get some work done, I dove in deeper and finally discovered that the SQL server was resolving to a different IP address when it was having problems.  I put an entry for the SQL server in my HOSTS file and BAM everything was working.  I reported this to the client's IT department and sure enough there was a problem with their DNS server.  So just keep the DNS in mind if you are ever having intermittent connectivity problems.