RE: ODBC SQLCloseCursor or SQLFreeHandle does not free the memory of CLOB field in Oracle.
- From: wread@xxxxxxxxxxxxxxxxxxxx (Warren Read)
- Date: Tue, 19 Jul 2005 21:44:35 GMT
One issue is that your call to SQLGetData uses the variable 'clobBuffer',
but your declaration uses a variable called 'pClobBuffer':
char *pClobBuffer = new char[10485670]; // 10 MB
...
SQLGetData(stmtHandle, 1, SQL_C_CHAR, clobBuffer, 10485670,&dError);
Was this a typo, or is this buffer allocated elsewhere?
Do you check the return codes from SQLFetch( ), SQLGetData( ),
SQLCloseCursor( )? Did they return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO?
Also, what is the value of 'dError' after you call SQLGetData( )? Does it
seem correct?
Nothing else jumps out at me here as to what is wrong. First I would
suggest pinging EasySoft and Oracle directly to see if they have any
suggestions.
--------------------
| From: Vadivel (csvadivel@xxxxxxxxx)
| Subject: ODBC SQLCloseCursor or SQLFreeHandle does not free the memory of
CLOB field in Oracle.
| Message-ID: <#MKrx8ffFHA.3656@xxxxxxxxxxxxxxxxxxxx>
| Newsgroups: microsoft.public.data.odbc
| Date: Thu, 30 Jun 2005 22:39:03 -0700
| NNTP-Posting-Host: shared2.orcsweb.com 66.129.69.1
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.data.odbc:2262
| X-Tomcat-NG: microsoft.public.data.odbc
|
| Hi,
|
|
| I am using a C++ application that connects to Oracle Database using
EasySoft ODBC driver. I face a strange problem when freeing the memory
after i fetch the CLOB data from the Oracle table.
|
|
| The piece of Code is below,
|
| char *pClobBuffer = new char[10485670]; // 10 MB
|
|
| // Prepare the SQL statement
| strcpy(pQuery, "SELECT clobdata FROM clobtable")
|
| /* Execute the SQL statement. Check for errors. */
| SQLExecDirect(stmtHandle,(SQLCHAR*)pQuery,SQL_NTS);
| SQLFetch(stmtHandle);
| SQLGetData(stmtHandle, 1, SQL_C_CHAR, clobBuffer, 10485670,&dError);
| SQLCloseCursor(stmtHandle);
| delete []pClobBuffer;
|
|
| The statement and connection handle is closed properly. Still i am seeing
the memory usage is exactly increasing by 10 MB(size of the buffer we
allocated to read the CLOB) for each query.
|
|
| This is not a memory leak, it's only the memory usage which is
| increasing for the process for every query involving this CLOB field.
|
| I tried changing the CLOB to Varchar in the database table, the above
piece of Code works without increase in memory usage.
|
|
| NOTE: We observed there is some special handling required to free the
memory buffer allocated to read the CLOB field. In DB2 site they are
saying SQLFreeStmt does not free the CLOB fields, FREE Alocator statement
must be used. Please see the below link which i refered, but this one is
for DB2.
|
|
http://publib.boulder.ibm.com/infocenter/db2help/index.jsp?topic=/com...
|
|
| Please suggest me if any special handling is required for ORACLE to free
the CLOB data.
|
| Our Env: C++, Solaris, ODBC, ORACLE, EasySoft driver
|
| thanks,
| Vadivel.
|
|
|
| **********************************************************************
| Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
| Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...
|
.
- References:
- ODBC SQLCloseCursor or SQLFreeHandle does not free the memory of CLOB field in Oracle.
- From: csvadivel@xxxxxxxxx
- ODBC SQLCloseCursor or SQLFreeHandle does not free the memory of CLOB field in Oracle.
- Prev by Date: RE: Quickbooks ODBC Driver
- Next by Date: RE: Help with SQLSetStmtAttr: SQL_ATTR_CONCURRENCY
- Previous by thread: ODBC SQLCloseCursor or SQLFreeHandle does not free the memory of CLOB field in Oracle.
- Next by thread: Re: Specifying character sets in ODBC
- Index(es):
Relevant Pages
|