草木瓜
一、提要
上文简单介绍了Windows下ProC配置开发,这次我们使用Linux平台再次配置Oracle ProC开发环境(RedHat Linux 9 + Oracle 92)。
相关内容,将再后续文章逐步引入。
一言以弊之,先易后难。
二、数据库环境
与Windows下十分类似,首先确认安装了组件,Oracle - Application Development - Pro C-C++ 。安装后会在$ORACLE_HOME/bin生成相应可执行文件,在$ORACLE_HOME/precomp/demo/proc下也会生成一些makefile文件和示例。
三、示例文件
|
main.pc #include "sqlca.h" |
代码其实是Windows的原版。
四、编译运行
无需修改任何参数文件,即安装后直接创建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
<ERROR> ORA-12541: TNS:no listener
成功编译运行,这里也可以使用《ProC动态SQL示例(第1,2,3种方法)》一文中的示例,将//注释全部替换为空,即可编译。
http://blog.csdn.net/liwei_cmg/archive/2006/05/29/759963.aspx
不过会有告警提示:
/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)。
相关专题
- 电脑配置手册 (8395篇文章)
- 服务器配置专栏 (10969篇文章)
- Linux服务器的安全性能 (20494篇文章)
- 揭秘Linux内存管理 (8120篇文章)
- 解析Linux文件系统 (8322篇文章)
- Wlan组网----家庭专题 (4210篇文章)
- Linux服务器 (13024篇文章)
- Linux系统实用教程 (8056篇文章)
- Linux安全应用宝典 (8056篇文章)
- Linux基础知识 (8412篇文章)
- Oracle数据库系统使用的几条经验分享 (5次浏览)
- Oracle数据库三种标准的备份方法 (4次浏览)
- Oracle数据库的四种启动方式 (3次浏览)
- 在TransactionScope中优先使用Oracle的.NET驱 (2次浏览)
- 如何手工创建Oracle数据库 (1次浏览)
- 详细介绍手工创建oracle数据库 (0次浏览)
- 数据安全手册:数据保存四项注意 (0次浏览)
- 几种oracle数据库恢复的练习示例 (0次浏览)
- 提高Oracle数据库系统Import的性能 (0次浏览)
- Oracle 9i在AIX上的性能调整 (0次浏览)



