views:

26

answers:

3

I have a task that runs nightly. It connects to a sql server on our network and when I run it from my machine it runs fine. When it runs from the other computer I get the following error.

System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

I've checked with our systems admin and he said nothing has changed on the sql box or on the box in question so I'm not sure why it runs fine from one and not the other. From what I've read about this error it sounds like it's a setting on the sql server that would disallow it to run on either box.

A: 

The first thing that leaps to my mind is firewall issue. Confirm that you can connect outbound from the non-functional box on port 1422.

Gray Area
A: 

I would check the settings just to be sure. http://support.microsoft.com/kb/914277

I would also make sure that windows firewall or some other security software didn't get turned on. (98% that is the culprit where I work.)

Kevin
A: 

Some questions to check

  • Do you connect with named pipes or through TCP/IP on your machine.

  • How are you establishing the connection? With a connection string? Is the connection string the same on both machines?

  • Are you logging in as a different user on the other machine?

CResults