Question SQL server 2008 - Connection problems

Adagio

Well-known member
Joined
Dec 12, 2005
Messages
162
Programming Experience
Beginner
I get this lovely message from time to time:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)​

First of all, yes, it is configured to allow remote connections
The error doesn't happen all the time. It mostly happens when I try to open/close a bunch of connections like this (just quick example):

VB.NET:
for i as integer = 0 to 2000
openConnectionToDataBase ' Run som quick stored procedure
CloseConnectionToDataBase

threading.thread.sleep(100)
next
If I do this, there's a high risk that the above exception is thrown

When it fails at opening connection I ping the database, it always returns in 0 milliseconds, so there are no network problems

Anybody who has any idea on what the problem could be? Google didn't turn out to be helpful, as it just tells me to enable remote connections, but it's already allowed
 

Adagio

Well-known member
Joined
Dec 12, 2005
Messages
162
Programming Experience
Beginner
Nobody who has any idea on what could be the problem here?

Pinging shows that there's no network problems and there's not much activity on the server at the time the problem occurs
 
Top Bottom