Hi,
I am trying to connect oracle database with simple c++ code with eclipse on redhat.
The code is...
#include <iostream>
#include <occi.h>
using namespace std;
using namespace oracle::occi;
int main(){
oracle::occi::Environment* environment;
oracle::occi::Connection *con;
oracle::occi::Statement* stmt;
oracle::occi::ResultSet* res;
try{
environment = oracle::occi::Environment::createEnvironment(oracle::occi::Environment::DEFAULT);
con = environment->createConnection("gldbuser", "gldbuser", "MYDATABSE");
stmt = con->createStatement("select * from example");
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;
}
nment->terminateConnection(con);
}catch(oracle::occi::SQLException &e){
std::cout<<e.what();
}
return 0;
}
nment->terminateConnection(con);
}catch(oracle::occi::SQLException &e){
std::cout<<e.what();
}
return 0;
}
Now the problem is..
**** Build of configuration Debug for project OCCIExample ****
make all
Building target: OCCIExample
Invoking: GCC C++ Linker
g++ -L"/root/awa_c++/OCCIExample" -o"OCCIExample" ./main.o -locci
/usr/bin/ld: cannot find -locci
collect2: ld returned 1 exit status
make: *** [OCCIExample] Error 1tus
what is the solution?
thanks & regards
AK