Employees.cpp file also:-
#include "Employees.h"
using namespace std;
using namespace oracle::occi;
int main (void)
{
Employees *pEmployees = new Employees();
pEmployees->List();
delete pEmployees;
cout << "ENTER to continue...";
cin.get();
return 0;
}
Employees::Employees()
{
user = "sys";
passwd = "sis123";
db = "oel01:1521/OEL11GR1.SAND";
env = Environment::createEnvironment(Environment::DEFAULT);
try
{
con = env->createConnection(user, passwd, db);
}
catch (SQLException& ex)
{
cout << ex.getMessage();
}
}
Employees::~Employees()
{
env->terminateConnection (con);
Environment::terminateEnvironment (env);
}
void Employees::List()
{
/*
* simple test method to select data from
* the employees table and display the results
*/
Statement *stmt = NULL;
ResultSet *rs = NULL;
string sql = "select employee_id, first_name, last_name " \
"from employees order by last_name, first_name";
try
{
stmt = con->createStatement(sql);
}
catch (SQLException& ex)
{
cout << ex.getMessage();
}
if (stmt)
{
try
{
stmt->setPrefetchRowCount(32);
rs = stmt->executeQuery();
}
catch (SQLException& ex)
{
cout << ex.getMessage();
}
con->terminateStatement(stmt);
}
}
======================
here also Employees.h file
#include <occi.h>
#include <iostream>
#include <iomanip>
using namespace oracle::occi;
using namespace std;
class Employees {
public:
Employees();
virtual ~Employees();
void List();
private:
Environment *env;
Connection *con;
string user;
string passwd;
string db;
};
My make file is:-
Employees: Employees.cpp
g++ -o Employees Employees.cpp \
-I$(ORACLE_HOME)//usr/include/oracle/11.1/client \
-L$(ORACLE_HOME) -lclntsh -locci
debug: Employees.cpp
g++ -ggdb3 -o Employees Employees.cpp \
-I$(ORACLE_HOME)/usr/include/oracle/11.1/client \
-L$(ORACLE_HOME) -lclntsh -locci
clean:
rm -f Employees
The sqlclient occi library already installed in /usr/include/oracle/11.1/client directory of centos The problem is on make file pls help me
If the path to the oracle headers is $(ORACLE_HOME)//usr/include/oracle/11.1/client
(from the -I
argument in your makefile) then I find it unlikely that the path to the libraries is $(ORACLE_HOME)
(from the -L
argument in your makefile) and it would seem much more likely to me to be $(ORACLE_HOME)//usr/lib/oracle/11.1/client
(or something like that).