有关ORACLE OCI函数问题

stone198305 2008-03-18 02:44:13
大家好,小弟在新公司改一个程序,这个程序用到了OCI函数,其中有一段代码如下
#ifdef ORACLE8
status = OCIStmtExecute(svchp,stmthp,errhp,(ub4)0, (ub4)0,(CONST OCISnapshot *)
NULL,(OCISnapshot *)NULL,(ub4)OCI_SCROLLABLE_CURSOR);
#endif
#ifdef ORACLE9
status = OCIStmtExecute(svchp,stmthp,errhp,(ub4)0, (ub4)0,(CONST OCISnapshot *)
NULL,(OCISnapshot *)NULL,(ub4)OCI_STMT_SCROLLABLE_READONLY);
#endif
这个程序支持ORACLE8和ORACLE9,头文件的宏定义 #define ORACLE9 0
这个程序编译出现以下问题,用的是makefile,操作系统位AIX5.1,数据库为ORACLE9
/usr/vacpp/bin/xlc -c ../public/public.c -o ../public/public.o
test -d ./bin||mkdir bin
/usr/vacpp/bin/xlc -c -o src/extract.o -I /oracle/rdbms/demo -I /oracle/rdbms/public -I /oracle/plsql/public -I /oracle/network/public -I /oracle/precomp/public src/extract.c
"src/extract.c", line 971.95: 1506-045 (S) Undeclared identifier OCI_STMT_SCROLLABLE_READONLY.
make: 1254-004 The error code from the last command is 1.
我把定义改成#define ORACLE8 0
编译,又出现如下问题,把status = OCIStmtExecute(svchp,stmthp,errhp,(ub4)0, (ub4)0,(CONST OCISnapshot *)
NULL,(OCISnapshot *)NULL,(ub4)OCI_STMT_SCROLLABLE_READONLY);中最好一个参数OCI_STMT_SCROLLABLE_READONLY改成其他,如OCI_DEFAULT,也会出现以下编译问题:
/usr/vacpp/bin/xlc -c ../public/public.c -o ../public/public.o
test -d ./bin||mkdir bin
/usr/vacpp/bin/xlc -c -o src/extract.o -I /oracle/rdbms/demo -I /oracle/rdbms/public -I /oracle/plsql/public -I /oracle/network/public -I /oracle/precomp/public src/extract.c
/usr/vacpp/bin/xlc -o bin/e_extract -L/oracle/lib32/ -L/oracle/rdbms/lib32/ -R/disk0/o9i/app/products/oracle/9.0.2/lib32 -laio -lposix4 -lkstat -lm -lthread -lclntsh `cat /oracle/lib/ldflags` `cat /oracle/lib/sysliblist` src/extract.o ../public/public.o
ld: 0706-027 The -R /disk0/o9i/app/products/oracle/9.0.2/lib32 flag is ignored.
ld: 0706-006 Cannot find or open library file: -l aio
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l posix4
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l kstat
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l thread
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l clntsh
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nbeq8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nhost8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nidx8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nus8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nk58
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nldap8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ldapclnt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nsslb8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l noname8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nrad8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nsid8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l n8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ncrypt8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ntcp8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ntcps8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nsslb8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l nent8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ntcp8
ld:open(): A file or directory in the path name does not exist.
ld: 0706-006 Cannot find or open library file: -l ntns8
ld:open(): A file or directory in the path name does not exist.
make: 1254-004 The error code from the last command is 255.

请问这是什么问题?如何解决?谢谢
...全文
213 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
nowplaycn 2008-08-21
  • 打赏
  • 举报
回复
你用了别人的Makefile的模版,但和你的环境不一致,所以导致连接不上。
抄没有关系,建议你要抄懂。
OCI从9开始只需要 -lclntsh 这个连接开关,有的平台要加 -laio 开关
建议你自己写Makefile,容易定位错误。

-----------------------------------------------------------
《征服C/C++企业软件开发核心技术》
主题词 unix/linux 多线程 网络通讯 数据库 内存排错和性能分析
http://www.khp.com.cn/books/detail.asp?bookid=1707
sailing0123 2008-08-20
  • 打赏
  • 举报
回复
已在另一个地方回帖。
knowledge_Is_Life 2008-05-01
  • 打赏
  • 举报
回复
不明LZ在说什么
wzjpsq 2008-03-20
  • 打赏
  • 举报
回复
帮顶
gebz456 2008-03-20
  • 打赏
  • 举报
回复
帮你顶起来
CathySun118 2008-03-19
  • 打赏
  • 举报
回复
要检查ORACLE8 和ORACLE9是否定义,这里要和定义的名字一致

17,090

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧