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 next 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.
Re: database connection with oracle using c++ /OCCI [message #662898 is a reply to message #662889] Mon, 15 May 2017 06:49 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
https://www.google.com/webhp?hl=en&tab=ww#hl=en&q=c%2B%2B+connect+to+oracle+example
Re: database connection with oracle using c++ /OCCI [message #662907 is a reply to message #662898] Mon, 15 May 2017 07:49 Go to previous messageGo to next message
vishudadhich001@gmail.com
Messages: 3
Registered: May 2017
Junior Member
thanks for the rply but I already visited this document .Nothing seems to work.
Re: database connection with oracle using c++ /OCCI [message #662912 is a reply to message #662907] Mon, 15 May 2017 08:04 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://www.tidytutorials.com/2009/08/oracle-c-occi-database-example.html
Re: database connection with oracle using c++ /OCCI [message #662914 is a reply to message #662912] Mon, 15 May 2017 08:30 Go to previous messageGo to next message
vishudadhich001@gmail.com
Messages: 3
Registered: May 2017
Junior Member
sorry but i also visited it .
Re: database connection with oracle using c++ /OCCI [message #662919 is a reply to message #662914] Mon, 15 May 2017 10:33 Go to previous message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator

Then you have to follow the error message and submit a bug report (about the compiler and so is not an Oracle issue).

Previous Topic: unable to generate pro*c .exe file on solaris11
Next Topic: COBOL and ORACLE (Pro* COBOL)
Goto Forum:
  


Current Time: Thu Dec 26 13:32:06 CST 2024