I have a simple program calling SQLDriverConnect (not OLEDB, not ADO, but ODBC) to an Oracle server 9.2, and then disconnect. The value of handle count increases by 2 each time I did the AllocHandle/connect/disconnect/FreeHandle. This has been verified in the following 3 environments with both Oracle ODBC driver and Microsoft ODBC for Oracle.

Environments:
1. WinXP SP1, MDAC 2.7 SP1, Oracle client 9.2.0.1, Oracle server 9i (9.2.0).
2. Win2000 SP4, MDAC 2.7 SP1, Oracle client 9.2.0.1, Oracle server 9i (9.2.0).
3. Win2000 SP4, MDAC 2.8, Oracle client 9.2.0.1, Oracle server 9i (9.2.0).

ODBC drivers:
1. Oracle ODBC driver version 9.02.00.54
2. Microsoft ODBC for Oracle version 2.573.9030.0

Here is the skelton code (single thread):
SQLAllocHandle(SQL_HANDLE_ENV, NULL, &henv);
while (true) {
construct connection string for a new Oracle server
SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
if (SQL_SUCCEEDED(SQLDriverConnect(hdbc,...))) {
SQLDisconnect(hdbc);
}
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
}

I used the same code to connect to SQL 2000 with MSSQL ODBC driver (version 2000.81.9042.00). There is no handle count leak.

Turning on/off ODBC connection pooling does not change the handle count leakage.

Connection caching is not an option for me since the application connects to a set of Oracle servers that keep changing.

Any pointers, ideas?

Thanks.

Kong