Home » Infrastructure » Linux » Problem with Linux OCCI (Fedora Core 6)
Problem with Linux OCCI [message #331225] Wed, 02 July 2008 12:18 Go to next message
turbowei
Messages: 2
Registered: July 2008
Junior Member
I am using the following:

[wweng@Monet src]$ rpm -qa | grep oracle
oracle-instantclient-devel-11.1.0.1-1
oracle-xe-10.2.0.1-1.0
oracle-instantclient-basic-11.1.0.1-1
oracle-instantclient-sqlplus-11.1.0.1-1
[wweng@Monet src]$ uname -a
Linux Monet 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:37:32 EDT 2006 i686 i686 i386 GNU/Linux
[wweng@Monet src]$ g++ --version
g++ (GCC) 4.1.1 20061011 (Red Hat 4.1.1-30)

Ok here is the problem that I ran into while writing an application with occi:

Here is the testing program I wrote, fairly simple:

#include "occi.h"

using namespace std;
using namespace oracle::occi;


int main()
{

Environment* m_env;
Connection* m_conn;
Statement* m_stmt;

ResultSet * pSet = NULL;
vector<MetaData> listMetaData;

int nColumns;
const char* dbname = "XE";
const char* user = "hr";
const char* pass = "hr";
const char* query = "select * from jobs";

m_env = Environment::createEnvironment();
m_conn = m_env->createConnection(user, pass, dbname);
m_stmt = m_conn->createStatement(query);

Statement::Status status;
status = m_stmt->status();

if( status != Statement::PREPARED )
{
printf("The statement is not prepared.\n");
goto _EXIT;
}

try
{
status = m_stmt->execute();
pSet = m_stmt->getResultSet();
}
catch (SQLException &sqlExcp)
{
printf("SQL Exception\n");
goto _EXIT;
}

listMetaData = pSet->getColumnListMetaData();
nColumns = listMetaData.size();
printf("nColumns: %d\n", nColumns);

_EXIT:
m_conn->terminateStatement(m_stmt);
m_env->terminateConnection(m_conn);
Environment::terminateEnvironment(m_env);

return 0;

}


Basically, it connects to hr/hr and print out the number of columns in table Jobs.

And here is how I compiled it:


[wweng@Monet src]$ g++ -I/usr/include/oracle/11.1.0.1/client/ -L/usr/lib/oracle/11.1.0.1/client/lib/ -locci -lclntsh -g -Wall main.cpp -o test
[wweng@Monet src]$ ./test
nColumns: 4
Aborted (core dumped)

And here is what I get for running the code under gdb:
[wweng@Monet src]$ gdb test
GNU gdb Red Hat Linux (6.5-8.fc6rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) run
Starting program: /.../[SKIPPED]/src/test
[Thread debugging using libthread_db enabled]
[New Thread -1208334640 (LWP 15243)]
nColumns: 4

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208334640 (LWP 15243)]
0x01f89f92 in kpuhhfre () from /usr/lib/oracle/11.1.0.1/client/lib/libclntsh.so.11.1
(gdb) bt
#0 0x01f89f92 in kpuhhfre () from /usr/lib/oracle/11.1.0.1/client/lib/libclntsh.so.11.1
#1 0x012a54c3 in OCIPHeapFree () from /usr/lib/oracle/11.1.0.1/client/lib/libclntsh.so.11.1
#2 0x006780c9 in oracle::occi::HeapAlloc<oracle::occi::RefCounted>::operator delete () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#3 0x006a1746 in _ZN6oracle4occi12MetaDataImplD9Ev () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#4 0x006a1781 in oracle::occi::MetaDataImpl::~MetaDataImpl$delete () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#5 0x006a1395 in oracle::occi::RefCounted::onZeroReferences () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#6 0x006a137f in oracle::occi::RefCounted::deleteRef () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#7 0x0067cfde in _ZN6oracle4occi8ConstPtrINS0_12MetaDataImplEED9Ev () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#8 0x0067cff5 in oracle::occi::ConstPtr<oracle::occi::MetaDataImpl>::~ConstPtr$base () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#9 0x0067cf67 in _ZN6oracle4occi3PtrINS0_12MetaDataImplEED9Ev () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#10 0x0067cf91 in oracle::occi::Ptr<oracle::occi::MetaDataImpl>::~Ptr () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#11 0x006a1f6b in _ZN6oracle4occi8MetaDataD9Ev () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#12 0x006a1fa9 in oracle::occi::MetaData::~MetaData () from /usr/lib/oracle/11.1.0.1/client/lib/libocci.so.11.1
#13 0x08049fe1 in std::_Destroy<oracle::occi::MetaData> (__pointer=0x81f6420) at /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_construct.h:107
#14 0x08049ff7 in std::__destroy_aux<oracle::occi::MetaData*> (__first=0x81f6420, __last=0x81f6438) at /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_construct.h:122
#15 0x0804a026 in std::_Destroy<oracle::occi::MetaData*> (__first=0x81f63d8, __last=0x81f6438) at /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_construct.h:155
#16 0x0804a040 in std::_Destroy<oracle::occi::MetaData*, oracle::occi::MetaData> (__first=0x81f63d8, __last=0x81f6438)
at /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_construct.h:182
#17 0x0804a183 in ~vector (this=0xbfbcdf3c) at /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../include/c++/4.1.1/bits/stl_vector.h:272
#18 0x08049b80 in main () at main.cpp:56

It points directly at vector<MetaData>'s destructor.

Can someone help to get the segmentation fault out? Or is the Linux OCCI flawed?

Thanks!
Wei
Re: Problem with Linux OCCI [message #331228 is a reply to message #331225] Wed, 02 July 2008 12:45 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Great 1st post!

I do not see anything obviously wrong.

Which source line is #56?

My one observation is that Fedora is/was never supported by Oracle.
By adding instantclient into the mix make me wonder about compatibility issues.
Re: Problem with Linux OCCI [message #331264 is a reply to message #331228] Wed, 02 July 2008 15:48 Go to previous message
turbowei
Messages: 2
Registered: July 2008
Junior Member
Line 56 is the one that returned in main() function, when the vector destructor was called and seemed have found its way into a blown up stack.

Thanks
Wei
Previous Topic: Problem to Install Oraclce 11g on Linux
Next Topic: Please check this Disk Partition
Goto Forum:
  


Current Time: Fri Mar 29 08:37:49 CDT 2024