Home » Developer & Programmer » Precompilers, OCI & OCCI » database connection with oracle using c++ /OCCI (oracle 11gR2)
database connection with oracle using c++ /OCCI [message #662889] Mon, 15 May 2017 03:21 Go to previous message
vishudadhich001@gmail.com
Messages: 3
Registered: May 2017
Junior Member
Hi guys,
I am new to oracle database and i was trying to establish connection with oracle database using c++ . Although i have code for connection with db but when I try to compile it using g++ it gives me following error-
In file included from <built-in>:7:
oracle/core/lmx/CoreException.java:44: internal compiler error: in uses_jv_markobj_p, at java/boehm.c:252
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

The command which am i using to compile cpp file is-
g++ -L $ORACLE_HOME/lib/* -L /root/Shared/instantclient_11_2_4/* -L $ORACLE_HOME/rdbms/lib/* cpp_db_conn.cpp
Here is my cpp file-

#include <iostream>
#include <occi.h>

using namespace oracle::occi;
using namespace std;

int main(){

oracle::occi::Environment* environment;
oracle::occi::Connection* con;
oracle::occi::Statement* stmt;
oracle::occi::ResultSet* res;

try{

environment = Environment::createEnvironment(Environment::DEFAULT);
con = environment->createConnection("tkmah7u", "root", "XE");

stmt = con->createStatement("select * from customers");
res = stmt->executeQuery();

while (res->next())
std::cout<<res->getInt(1)<<" "<<res->getString(2)<<std::endl;

stmt->closeResultSet(res);
con->terminateStatement(stmt);
environment->terminateConnection(con);

}catch(oracle::occi::SQLException &e){
std::cout<<e.what();
}

return 0;
}

Need your suggestions, why am i getting this error.
Thank you.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: unable to generate pro*c .exe file on solaris11
Next Topic: COBOL and ORACLE (Pro* COBOL)
Goto Forum:
  


Current Time: Tue Apr 16 10:01:36 CDT 2024