RE: Multiple DB sessions and tcp ports limitation

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Andrei,
Thanks for your detailed code snippet here.

I performed a test at my side however I could not reproduce your issue. The
following code worked fine at my side:
#include "atldbcli.h"
...
::CoInitialize(NULL);
CDataSource dataSource;
CSession session;

HRESULT hr =
dataSource.OpenFromInitializationString(L"Provider=SQLOLEDB.1;Data
Source=Charles-2k3;Initial Catalog=GT;Integrated Security=SSPI");

for (int i=0; i<1000; i++ ) {
session.Open(dataSource);
//cout<<"Open "<<i<<endl;
session.Close();
//cout<<"Close "<<i<<endl;
}

dataSource.Close();

cout<<"Finished!";
::CoUninitialize();

When I ran TCPView on my client machine, I just saw one record
"MFCConsole.exe:4172 TCP charles-xp:1441 charles-2k3:ms-sql-s
ESTABLISHED" like yours generated when
dataSource.OpenFromInitializationString() was called; when
dataSource.Close() was called, the following record like yours was
generated:
"[System Process]:0 TCP charles-xp:1441 charles-2k3:ms-sql-s TIME_WAIT "

I did not see any messages caused by session.Open and session.Close in
TCPView report. Actually there is only one database connection here, no
short-time repeated connections occur in this program.
I am not sure why you could see so many repeated connection records in
TCPView. If you could provide me (changliw_at_microsoft_dot_com) a
reproducible project, I am very glad for performing further research. Also
if there is anything I misunderstood, please feel free to point out.

My test environment was as following:
Client: Windows XP SP2
Server: Windows Server 2003 SP2
IDE: Visual Studio 2005 SP1

Please feel free to let me know if you have any questions or concerns. It
is my pleasure to be of assistance.

Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================

















.



Relevant Pages

  • Re: Shared Fax Service
    ... reproduce it. ... Mine still works fine after SP2. ... > When clients send a fax there is an option in the send ... > fax wizard to recieve a notification that the fax has ...
    (microsoft.public.windowsxp.print_fax)
  • Re: CoInitialize fails with E_ACCESSDENIED after upgrade to XP SP2, why?
    ... Brian Muth wrote: ... > application on XP SP2 on a different box, and it is working perfectly fine. ... > reproduce the problem first if you are going to make any headway, ... because I am logging the return value of CoInitialize ...
    (microsoft.public.win32.programmer.ole)
  • Re: Persistent C00D109B or 8007007E error
    ... this would be easy to reproduce. ... > from the web under WMP10 on a PC without SP2 but cannot be played on three ... > It can also be played by opening under GraphEdt in DirectX SDK. ... >>>I am unable to play certain avi files that used to play OK before ...
    (microsoft.public.windowsmedia.player)
  • Re: bottom of star page border, [19th in list] doesnt print
    ... I wasn't able to reproduce the problem with Office 2003 SP2. ... What printer driver, settings are you using? ...
    (microsoft.public.office.misc)
  • Re: CoInitialize fails with E_ACCESSDENIED after upgrade to XP SP2, why?
    ... When you say you can't reproduce it I'm assuming you have run the ... application on XP SP2 on a different box, and it is working perfectly fine. ... > machines creates a child process using CreateProcess. ... CoInitialize fails with 0x80070005 ...
    (microsoft.public.win32.programmer.ole)