- 论坛徽章:
- 0
|
oraclesearch: error while loading shared libraries: libodm9.so: cannot open shared object file: No such file or directory
我就是最简单的连接oracle,然后查询
结果报这个错,而libodm9.so是位于$ORACLE_HOME/lib下的。
compile文件:
proc test.pc
gcc -I $ORACLE_HOME/precomp/public -c test.c
g++ -I $ORACLE_HOME/precomp/public -c main.cc
g++ -o test test.o main.o -L $ORACLE_HOME/lib -lclntsh
编译没错,执行就报上面的错。
test.h
#ifdef __cplusplus
extern "C" {
#endif
int connectDB();
int query();
#ifdef __cplusplus
}
#endif
下面是test.pc
#include <sqlca.h>
#include "test.h"
int connectDB (char * url,char * name)
{
char user_pwd[20];
memset(user_pwd,0,20);
strcpy(user_pwd,"abc/aid13#");
exec sql connect:user_pwd;
if(sqlca.sqlcode ==0)
return 1;
else
return -sqlca.sqlcode;
}
int query()
{
exec sql begin declare section;
int i_account_id=0;
short indicator;
exec sql end declare section;
exec sql select i_account_id into :i_account_id:indicator from transaction where i_transaction_id=1052151818;
if(indicator!=0)
printf("not found");
printf("indicator is %d\n",indicator);
printf("i_account_id %d\n",i_account_id);
}
main.cc
#include <iostream>
#include <cstring>
#include "test.h"
using namespace std;
int main()
{
int ret=connectDB();
if(ret==1)
cout<<"done"<<endl;
else
cout<<"damn"<<endl;
query();
}
请高手帮忙看一下,多谢了。。。 |
|