473,395 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Handle count leak when connecting to Oracle via ODBC on Windows

Environments:
1. WinXP SP1, MDAC 2.7 SP1 (Microsoft ODBC for Oracle is
2.573.9030.0), Oracle client 9.2.0.1.
2. Win2000 SP4, MDAC 2.7 SP1 (Microsoft ODBC for Oracle is
2.573.9030.0), Oracle client 9.2.0.1.
3. Win2000 SP4, MDAC 2.8 (Microsoft ODBC for Oracle is 2.573.1022.0),
Oracle client 9.2.0.1.

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 connect/disconnect.
This has been verified on the above 3 environments. 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.

Is this a known problem? I did not try Oracle's own ODBC driver.

Any pointers, ideas?

Thanks.

Kong
li****@email.com
Jul 19 '05 #1
4 7868
li****@email.com (Kong Li) wrote in message news:<9e**************************@posting.google. com>...
Environments:
1. WinXP SP1, MDAC 2.7 SP1 (Microsoft ODBC for Oracle is
2.573.9030.0), Oracle client 9.2.0.1.
2. Win2000 SP4, MDAC 2.7 SP1 (Microsoft ODBC for Oracle is
2.573.9030.0), Oracle client 9.2.0.1.
3. Win2000 SP4, MDAC 2.8 (Microsoft ODBC for Oracle is 2.573.1022.0),
Oracle client 9.2.0.1.

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 connect/disconnect.
This has been verified on the above 3 environments. 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.

Is this a known problem? I did not try Oracle's own ODBC driver.

Any pointers, ideas?

Thanks.

Kong
li****@email.com

From the Microsoft ODBC's version number it looks like you are using a
Oracle 7 compatible ODBC driver. I don't think Oracle 9.2 supports
Oracle 7 connections any longer. You could verify the sqlnet version
being used by selecting from v$session. If it shows TNS V1-V2 instead
of TNS V1-V3 you are using an obsolete driver.

Sybrand Bakker
Senior Oracle DBA
Jul 19 '05 #2
li****@email.com (Kong Li) wrote
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 connect/disconnect.
This has been verified on the above 3 environments. Turning on/off
ODBC connection pooling does not change the handle count leakage.
If it works the same way on different versions, maybe then it works as
designed. I would think that a handle counter cannot really "leak" in
the same way as allocated handles leak memory when not properly
freed...
Is this a known problem? I did not try Oracle's own ODBC driver.
Is this the right forum to ask ODBC related questions? IMO not.
Any pointers, ideas?


Try the question in a ODBC/Microsoft forum. Use a MSAccess or
SQL-Server driver to determine if this is related to Oracle ODBC
driver only. Read the ODBC API specification to determine exactly how
the handle count works. Connect your app to the ODBC driver via an
ODBC debugger (there used to be a great one in the ODBC DDK that
shipped with DevNet in the 90's).

--
Billy
Jul 19 '05 #3
Follow up to this thread,
Instead of Microsoft ODBC for Oracle, I also used Oracle ODBC driver
(version 9.02.00.54) while keeping everything else the same. There is
also handle count leak. 2 per
AllocHandle/connect/disconnect/FreeHandle, identical to the behavior
of using Microsoft ODBC for Oracle.

To be more specific, after a successful SQLDriverConnect, the handle
count increases quiet a few. After the SQLFreeHandle(SQL_HANDLE_DBC,
hdbc), the handle count drops back but is still 2 more than the handle
count value before SQLDriverConnect.

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. This leads
me to believe the code itself is correct.

The Oracle server is 9i (9.2.0).

Here is the skelton code:

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);
}

Any ideas or pointers?

Thanks.

Kong

vs****@onwe.co.za (Billy Verreynne) wrote in message news:<1a**************************@posting.google. com>...
li****@email.com (Kong Li) wrote
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 connect/disconnect.
This has been verified on the above 3 environments. Turning on/off
ODBC connection pooling does not change the handle count leakage.


If it works the same way on different versions, maybe then it works as
designed. I would think that a handle counter cannot really "leak" in
the same way as allocated handles leak memory when not properly
freed...
Is this a known problem? I did not try Oracle's own ODBC driver.


Is this the right forum to ask ODBC related questions? IMO not.
Any pointers, ideas?


Try the question in a ODBC/Microsoft forum. Use a MSAccess or
SQL-Server driver to determine if this is related to Oracle ODBC
driver only. Read the ODBC API specification to determine exactly how
the handle count works. Connect your app to the ODBC driver via an
ODBC debugger (there used to be a great one in the ODBC DDK that
shipped with DevNet in the 90's).

Jul 19 '05 #4

"Kong Li" <li****@email.com> a écrit dans le message de
news:9e**************************@posting.google.c om...
Follow up to this thread,
Instead of Microsoft ODBC for Oracle, I also used Oracle ODBC driver
(version 9.02.00.54) while keeping everything else the same. There is
also handle count leak. 2 per
AllocHandle/connect/disconnect/FreeHandle, identical to the behavior
of using Microsoft ODBC for Oracle.

To be more specific, after a successful SQLDriverConnect, the handle
count increases quiet a few. After the SQLFreeHandle(SQL_HANDLE_DBC,
hdbc), the handle count drops back but is still 2 more than the handle
count value before SQLDriverConnect.

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. This leads
me to believe the code itself is correct.

The Oracle server is 9i (9.2.0).

Here is the skelton code:

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);
}

Any ideas or pointers?

Thanks.

Kong


Does it actually break after N connections ? I've seen this occuring in the
OLD days of oracle 7.1.6 wit OCI programs that repeatedly
connected/diconnected.

Why don't you use the newest ORACLE ODBC drivers instead of Micro$oft ? You
could use the new features of the database and maybe fix the problem at the
same time.

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kong Li | last post by:
Follow up to this thread, the latest Oracle 9i release 2 patchset (9.2.0.5) fixed the handle count leak problem. The problem is in Oracle client component. Thanks. Kong ----- From: Kong...
3
by: va | last post by:
I am trying to establish a connection to Oracle 9i from asp.net.(.net 2003) The code is Dim con As New ADODB.Connection con.ConnectionString = "PROVIDER=MSDASQL;DRIVER= {Microsoft ODBC for...
1
by: yahibble | last post by:
Now, I am no Python expert but I have dabbled and I have spent a couple of days with another engineer unsuccessfully installing oracle drivers for MS ODBC on the win XP machine. It looked to me...
12
by: Ken Brubaker | last post by:
I am using DB2 8.5 FP5 on Windows 2000 Server and have noticed what appears to be a handle leak. When I execute a DB2 connect statement in a command window, followed by a DB2 connect reset...
4
by: Terry | last post by:
There are a number of things about using unmanaged resources in Windows Forms programming that is unclear to me. In C++, if you loaded an icon resource using "ExtractIcon()", the resource was...
3
by: Andrew McGregor | last post by:
Hi, I am trying to get a VB.NET application to connect to a local Oracle 9i Lite database. What is the correct form for a connect string? cn = New...
2
by: Mahesh.V | last post by:
Hi All I get the following error while connecting to the oracle database using ODBC. in my VB.NET application. Can any one help me out solving this problem server message (if any):...
16
by: network-admin | last post by:
We have Problems with Access query on Oracle 10g Database with ODBC Connection. The Query_1 is such as select * from xtable where ycolumn <"S" Result = ODBC Faild...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.