Home » Developer & Programmer » Precompilers, OCI & OCCI » Problem with C++ STL string, getString() and VARCHAR...
Problem with C++ STL string, getString() and VARCHAR... [message #254245] Thu, 26 July 2007 05:04 Go to next message
miliziano
Messages: 1
Registered: July 2007
Location: ITALY
Junior Member
Hi,
I've an incredible problem with memory when I try to extract a string from Oracle by means of OCCI.

The problem occurs when the method ends. Example:

void function(){
string _str;
//... the connection...
//... the executeQuery...

_str=_rs->getString(1);
cout<<_str;

//... It's ok.
//...close result set and other...

}

...but when the method ends, the runtime language crashes because it doesn't can free the string object (_str).
This problem doesn't occour with CHAR type (in the DB). Only with VARCHAR.

The stack trace is:


*** glibc detected *** /home/marco/workspace2/Runtime/bin/ConfMgr: munmap_chunk(): invalid pointer: 0x08099dc0 ***
======= Backtrace: =========
/lib/libc.so.6[0xb6b126e1]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb6cbcf81]
/usr/lib/libstdc++.so.6(_ZNSs4_Rep10_M_destroyERKSaIcE+0x1d)[0xb6c9a03d]
/usr/lib/libstdc++.so.6(_ZNSsD1Ev+0x57)[0xb6c9cbc7]
...

In the debug mode I can see that is the free of _str that produces the problem.

The Environment is GCC 4.1.2, Eclipse CDT and OCCI for Oracle 10.1.2

Thanks...
Re: Problem with C++ STL string, getString() and VARCHAR... [message #273086 is a reply to message #254245] Tue, 09 October 2007 01:25 Go to previous message
kmohan
Messages: 28
Registered: July 2005
Junior Member
OCCI 10.1 is not supported with gcc4.1. You can try 10.2 OCCI libraries which support gcc4.
http://www.oracle.com/technology/tech/oci/occi/occidownloads.html
Previous Topic: lclntst10 not found error
Next Topic: Unicode Support - CreateEnvironment
Goto Forum:
  


Current Time: Thu Mar 28 16:12:29 CDT 2024