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