Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Problem with handle leaks...?!
Hello world,
I have problems to connect to an Oracle server via MFC/ODBC. 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... (Visual C++ 6.0 SP5, Oracle 8.1.7.0, Microsoft ODBC driver for Oracle 2.573.9030.00 as well as Oracle ODBC driver 8.01.07.00, Windows 2000 Prof. SP4)
Best regards,
Tilman Kuepper
-=-=-=-=-=-=-=-=-=-
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;
}
Received on Wed Jul 30 2003 - 09:41:02 CDT
![]() |
![]() |