all groups > sql server connect > september 2005 >
You're in the

sql server connect

group:

SQL Server does not exist or access denied.


SQL Server does not exist or access denied. stevehunter_1 NO[at]SPAM hotmail.com
9/29/2005 2:45:10 PM
sql server connect: I get the following error when trying to connect to SQL Server

SQL Server does not exist or access denied.
ConnectionOpen (Connect()).

Scenario:

The application connects to SQL Server very frequently (million+ times
per day). It fails with this error message about 100 times.

The failure rate is not very high and unfortunately, I can not open one
or more connections. I must open connection and close and do this
again a million times.

So I need to solve this problem. Where would you start? I set
timeout to 2 minutes and this helped a lot, but i still get errors.
Re: SQL Server does not exist or access denied. Brad Sarsfield
9/29/2005 5:03:38 PM
There are a number of things that could be going on here. Let's get some
more info on your environment

What transport are you using (TCP, LPC, NP)?
TCP has is less overhead and network reads/writes over NP.
Check out the following KB's for tweaking your TCP ack depending on your
environment
http://support.microsoft.com/kb/328890/
http://support.microsoft.com/default.aspx?scid=kb;en-us;q315669

There is also a limit on the number of open TCP ports that you can have
at any given time.
There are others under HKLM\SYSTEM\CurrentControlSet\Services\TcpIp
check it out on MSDN.

Are you using SQL auth?
I have seen issues if the DC isn't available (network) and you're using
domain users.

What is the load of the client(s)/server connecting? Are there any specific
loads during failure time?
If either are under heavy memory / cpu pressure you could experience
dropped connecitons.

I would really like to help understand what's going on in your environment.

Have you considered using connection pooling? A million connections per day
is about 10-12 new connections per second. That could be a significant load
depending on how much work is going on in the engine.

--
Brad Sarsfield [MSFT] bradsa(at)microsoft.com

This posting is provided "AS IS", with no warranties, and confers no rights.

[quoted text, click to view]

Re: SQL Server does not exist or access denied. stevehunter_1 NO[at]SPAM hotmail.com
9/30/2005 1:09:19 PM
Brad, Thanks for your help. see my replies below:


[quoted text, click to view]


I am using TCP/IP. Do I apply these KB articles to the Client or the
SQL Server? The SQL Server is W2000, Client is 2003


[quoted text, click to view]

At peak, we will open/close 100 connections a second.

[quoted text, click to view]

Using SQL Auth.

[quoted text, click to view]

During heavy use, we see the problem more, but I do not attribute it to
load, i just attribute it to more connection attempts. So more
connection attempts=more failures.


[quoted text, click to view]

I have considered connection pooling, but there is no performance issue
doing it this way. It works very well otherwise. I would prefer a
simple solution to the problem and would tackle connection pooling or
some other method in the future when it is time to upgrade the
application.


[quoted text, click to view]
Re: SQL Server does not exist or access denied. Brad Sarsfield
9/30/2005 1:56:27 PM
I'd try applying it first on server. It sounds like you may be getting into
the situation where you could be running out of available socket connections
for new connections or memory for new connections. For the first two you
can try to play with the following two reg keys. (Decrease the
TcpTimedWaitDelay). For the second you may need to add more memory (if sql
is infact running out of memory).

From:
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/networking/tcpip03.mspx#EGAA

TcpTimedWaitDelay
Key: Tcpip\Parameters

Value Type: REG_DWORD-time in seconds

ValidRange: 30-300 (decimal)

Default: 0xF0 (240 decimal)

Description: This parameter determines the length of time that a connection
stays in the TIME_WAIT state when being closed. While a connection is in the
TIME_WAIT state, the socket pair cannot be reused. This is also known as the
2MSL state because the value should be twice the maximum segment lifetime on
the network. See RFC 793 for further details.


--
Brad Sarsfield [MSFT] bradsa(at)microsoft.com


This posting is provided "AS IS", with no warranties, and confers no rights.


[quoted text, click to view]

Re: SQL Server does not exist or access denied. stevehunter_1 NO[at]SPAM hotmail.com
10/11/2005 8:24:14 PM
Brad

I tried this with no success.

Also, I checked my ODBC Admin screen and note that the "SQL Server"
driver has enabled connection pooling. So I assume in my MFC
application (using CDatabase with ODBC) it is automatically connection
pooling for me?

There are no network issues connecting to the server (i am able to
"ping" millions of times all day long with success).

Any ideas?


[quoted text, click to view]
Re: SQL Server does not exist or access denied. Brad Sarsfield
10/12/2005 10:10:35 AM
Steve,

Lets make sure that this is the problem that you're running into: If on your
server you run netstat -aon and you have thousands of ports in the TIME_WAIT
state your clients will run into this problem.

A while back we wrote a KB article on this problem. We should also try to
adjust your MaxUserPort in addition to the TcpTimedWaitDelay setting on the
server. Check this out and let me know how this goes.
http://support.microsoft.com/kb/328476

With regards to connection polling the ODBC admin connection pooling tab
'enable' 'disable' refers to performance monitoring of the pooled
connections. To pool the conneciton your appliction must follow the five
steps outlined here.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_connection_pooling.asp
here's an examle as well
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmdac/html/pooling2.asp

Let me know if the steps in the KB work for you.

--
Brad Sarsfield [MSFT] bradsa(at)microsoft.com

This posting is provided "AS IS", with no warranties, and confers no rights.


[quoted text, click to view]

AddThis Social Bookmark Button