occi: No such file or directory -- error: `oracle' has not been declared [message #253506] |
Tue, 24 July 2007 02:37 |
chandu2u
Messages: 3 Registered: July 2007
|
Junior Member |
|
|
Hi
I tried to compile below program
#include <iostream>
#include <occi>
using namespace oracle::occi;
using namespace std;
main()
{
string usr[100]="ptrqa_daily_dbo";
string pwd[100]="welcome99#";
string SID[100]="";
Environment *env=Environment::createEnvironment();
Connection *conn= env->CreateConnection(usr,pwd,SID);//all strings
Statement *stmt = conn->createStatement("select name from test"); //Optionally you can provide your Query here
stmt->setSQL();
ResultSet *rs = stmt->executeQuery();
while(rs->next()) { getString(column ID)}
rs->getString(1);
try {} catch(exception& ex) { }
cout<<ex.what()<<endl;
}
I got compilation error as
sample.cpp:2:16: occi: No such file or directory
sample.cpp:3: error: `oracle' has not been declared
sample.cpp:3: error: expected namespace-name before ';' token
sample.cpp:3: error: `<type error>' is not a namespace
Pls help in resolving thie error
|
|
|
|
|
|
|
Re: occi: No such file or directory -- error: `oracle' has not been declared [message #269198 is a reply to message #253862] |
Fri, 21 September 2007 02:17 |
sanjoykumar.n@hcl.in
Messages: 2 Registered: September 2007 Location: Bangalore
|
Junior Member |
|
|
hi guy... U test below Code... It vil worl Fine...
#include <iostream>
#include <occi.h>
using namespace oracle::occi;
using namespace std;
main()
{
string usr[100]="ptrqa_daily_dbo";
string pwd[100]="welcome99#";
string SID[100]="";
Environment *env=Environment::createEnvironment();
Connection *conn= env->CreateConnection(usr,pwd,SID);//all strings
Statement *stmt = conn->createStatement("select name from test"); //Optionally you can provide your Query here
stmt->setSQL();
ResultSet *rs = stmt->executeQuery();
while(rs->next()) { getString(column ID)}
rs->getString(1);
try {} catch(SQLException ex)
{
cout<<ex.what()<<endl;
}
}
cheers,
sanju
|
|
|