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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |