Slow connect times to (local) SQL2K using VC++ (but not VB)

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Warren Mason (anonymous_at_discussions.microsoft.com)
Date: 02/01/04


Date: Sat, 31 Jan 2004 20:41:06 -0800

I'm experiencing long delays (14 seconds) establishing a connection to a DB on my local machine using C++;

10:33:09 m_constr="Provider=sqloledb;Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI"
10:33:23 connection completed

  _ConnectionPtr pconn = NULL;

  hr = pconn.CreateInstance(__uuidof(Connection));
  TESTHR(hr);
  pconn->Open ((LPCSTR) m_connstr, L"", L"", adConnectUnspecified);

When I step over the above statement in the debugger, I see about 20 DLLs load, but this happens quickly. The delay is after the DLLs load. The connection eventually succeeds and I can access the DB. Opening a connection to this DB from an Access project, or from Query Analyzer using the same settings happens quickly.

Using the machine name instead of "(local)", is also slow from VC++, but if I use the localhost IP address 127.0.0.1, the connection happens quickly from VC++.

The only thoght I had was that the C++ runtime library was timing out on a DNS lookup that was not being done from VB, or if the IP address was used.

Environemt:
SQL Server 200 (SP3)
Windows XP (SP1)
MDAC 2.8 (also occurred on 2.7)
Visual Studio 2002 (VC++ 7.0)



Relevant Pages

  • 1.0 to 1.1 upgrade problem? broken html...
    ... I am experiencing a very strange problem after I upgraded my web ... On my host server everything shows fine, but on my local machine ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: visual studio not debugging
    ... >>> windows applications are working fine ... >>>> Are u experiencing this problem only for webapplications or for ... >>>>> However, when i try debug my projects in visual studio, it just ... >>>>> I have given the user Adminstrator privilages on the local machine. ...
    (microsoft.public.dotnet.framework.aspnet)
  • MTA queues between two servers in same site
    ... We are experiencing long delays for mail that is being passed between the ... two servers. ... We are also getting an error message in the log (repeated many ...
    (microsoft.public.exchange.connectivity)
  • Re: CRBs for all Trustees?
    ... six month delays on CRB's last september you wrote "Not true to the ... are experiencing. ... in september and if we have a cold autumn we won't be on the water. ... It is now possible to track online the form's progress whilst at CRB. ...
    (uk.rec.scouting)
  • Long delay pasting into Word from a web form.
    ... Recently I have been experiencing very long delays when pasting web form ... contents into a Word document. ...
    (microsoft.public.word.docmanagement)