Unix Technical Forum

Handle leaks...Multithreading

This is a discussion on Handle leaks...Multithreading within the MySQL forums, part of the Database Server Software category; --> Hello world, I have problems to connect to an MySQL server via ODBC Connector 3.51.23 and Cherry City Software ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:32 AM
wolters@xgraphic.de
 
Posts: n/a
Default Handle leaks...Multithreading

Hello world,

I have problems to connect to an MySQL server via
ODBC Connector 3.51.23 and
Cherry City Software MySQL OLE DB Provider respectively.

There seems to be a handle leak if I open/close the db
connection from a worker thread. (Windows Task Manager shows
that for every database connection two more handles are
needed.)


I have attached a small test program which shows this
problem. (The database connections are created inside the
worker threads because the db user names and passwords
are constantly changing. In my "real" project it's possible
to have up to 10 parallel threads connecting to the
server.)


Please... help...


Best regards,
M. Wolters

-=-=-=-=-=-=-=-=-=-


unsigned int MyThread(void*)
{
std::cout << "Open... ";
CDatabase db;
db.OpenEx("DSN=MyDSN;UID=tilli;PWD=tilli", 0);
db.Close();
std::cout << "Close...\n";


return 0;



}


int main()
{
VERIFY(AfxWinInit(GetModuleHandle(0), 0, GetCommandLine(), 0));

for(int i=0; i<500; ++i)
{
std::cout << i << "\n";
AfxBeginThread(MyThread, 0);
Sleep(2500);
}


return 0;



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 07:01 PM.


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