手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux平台配置Oracle ProC开发环境

[日期:2007-08-13] 来源:Linux公社  作者:Linuxidc [字体:大 中 小]
四、编译运行
无需修改任何参数文件,即安装后直接创建main.pc,执行如下命令:

$ proc parse=none iname=main.pc

Pro*C/C++: Release 9.2.0.4.0 - Production on Thu Jun 7 14:17:05 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

System default option values taken from: /home/ora/ora9/oracle/precomp/admin/pcscfg.cfg

$ gcc -g -o main main.c -I/home/ora/ora9/oracle/precomp/public -L/home/ora/ora9/oracle/lib -lclntsh

$ ./main

ORA-12541: TNS:no listener

成功编译运行,这里也可以使用《ProC动态SQL示例(第1,2,3种方法)》一文中的示例,将//注释全部替换为空,即可编译。
不过会有告警提示:
/tmp/ccC7E6qe.o(.text+0xea): In function `db_connect':
/home/ora/develop/src/db.c:385: the `gets' function is dangerous and should not be used.

这个是由于使用了gets函数所致,见gets的man手册:

BUGS
Never use gets(). Because it is impossible to tell without knowing the
data in advance how many characters gets() will read, and because
gets() will continue to store characters past the end of the buffer, it
is extremely dangerous to use. It has been used to break computer
security. Use fgets() instead.
It is not advisable to mix calls to input functions from the stdio
library with low - level calls to read() for the file descriptor asso-
ciated with the input stream; the results will be undefined and very
probably not what you want.

要解决这个问题,可以使用scanf函数替换gets,获取屏幕输入。如 scanf("%s",cmd)。linux
【内容导航】
第1页:Linux平台配置Oracle ProC开发环境 第2页:Linux平台配置Oracle ProC开发环境
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款