Unix Technical Forum

problem using SQL server connectivity

This is a discussion on problem using SQL server connectivity within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> Hi i'm making an application that open many threads and each thread is interacting with SQL database executing some ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 07:14 PM
Usman Jamil
 
Posts: n/a
Default problem using SQL server connectivity

Hi
i'm making an application that open many threads and each thread is
interacting with SQL database executing some queries. when all the threads
are closed..and i checked port status using "netstat.exe utility" i found
out that there were numerous statments like this.

TCP usman:2473 usman : ms-sql-s
TIME_WAIT

I was wondering what does it mean..is it that i've left sql server in any
unstable state. or what..
let me tell that i'm using a single connection for all threads to share. and
this is an example of how threads are interacting with the database.

------------------------------------------------------------------------
//Global Conection
pConnection->ConnectionString = sConnectionString.AllocSysString();

hr = pConnection->Open("","","",adConnectUnspecified);
------------------------------------------------------------------------
//A function being called by the thread

_CommandPtr pCommand = NULL;

_RecordsetPtr pRset = NULL;

hr = S_OK;

try{

hr = pCommand.CreateInstance(__uuidof(Command));

pCommand->ActiveConnection = pConnection; //Assign global
connection

pCommand->CommandText = sUpdateQuery;

pCommand->Execute(NULL,NULL,adCmdText);
}
catch(_com_error &e)
{
FormatError(e);
return;
}
if(SUCCEEDED(hr))
pCommand.Release();

---------------------------------------------------------------------------
//and in the end after all the threads have finished

if(pConnection->GetState() == adStateOpen)
pConnection->Close();
---------------------------------------------------------------------------

..i hope i'm not leaving any connections open..but i'm using only one
connection and even that is being properly closed. please help me with this
issue.

Regards

Usman Jamil


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:06 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com