Slow connect times to (local) SQL2K using VC++ (but not VB)
From: Warren Mason (anonymous_at_discussions.microsoft.com)
Date: 02/01/04
- Next message: Eric Lenington: "Changing connection string without establishing new connection object"
- Next in thread: Stephen Howe: "Re: Slow connect times to (local) SQL2K using VC++ (but not VB)"
- Reply: Stephen Howe: "Re: Slow connect times to (local) SQL2K using VC++ (but not VB)"
- Messages sorted by: [ date ] [ thread ]
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)
- Next message: Eric Lenington: "Changing connection string without establishing new connection object"
- Next in thread: Stephen Howe: "Re: Slow connect times to (local) SQL2K using VC++ (but not VB)"
- Reply: Stephen Howe: "Re: Slow connect times to (local) SQL2K using VC++ (but not VB)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|