




全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Linux 环境下 PRO C 程序的编写简单范例 Oracle 数据库版本 10 2 1 0 Linux 版本 Red Hat Enterprise AS3 环境介绍 oracle 数据库和服务均安装到 linux 主机上 一 oracle 用户的环境变量设置如下 oracle guohui6 oracle cat bash profile bash profile Get the aliases and functions if f bashrc then bashrc fi User specific environment and startup programs ORACLE BASE mydatafile2 app oracle export ORACLE BASE ORACLE SID ORCL export ORACLE SID ORACLE SID AUXY export ORACLE SID ORACLE HOME ORACLE BASE oracle product 10 2 0 db 1 export ORACLE HOME PATH PATH HOME bin ORACLE HOME bin export PATH LD LIBRARY PATH ORACLE HOME lib usr lib usr local lib export LD LIBRARY PATH NLS LANG american america ZHS16GBK export NLS LANG export PATH unset USERNAME oracle guohui6 oracle 二 查看 oracle 用户的登录环境 oracle guohui6 oracle id uid 501 oracle gid 501 oinstall groups 501 oinstall 502 dba oracle guohui6 oracle env REMOTEHOST 192 169 1 7 HOSTNAME guohui6 SHELL bin bash TERM vt100 HISTSIZE 1000 NLS LANG american america ZHS16GBK QTDIR usr lib qt 3 1 OLDPWD home oracle backuprestor101 proc code USER oracle LD LIBRARY PATH mydatafile2 app oracle oracle product 10 2 0 db 1 lib usr lib usr local l ib LS COLORS no 00 fi 00 di 01 34 ln 01 36 pi 40 33 so 01 35 bd 40 33 01 cd 40 33 01 or 01 05 37 41 mi 01 05 37 41 ex 01 32 cmd 01 32 exe 01 32 com 01 32 btm 01 32 ba t 01 32 sh 01 32 csh 01 32 tar 01 31 tgz 01 31 arj 01 31 taz 01 31 lzh 01 31 zip 01 31 z 01 31 Z 01 31 gz 01 31 bz2 01 31 bz 01 31 tz 01 31 rpm 01 31 c pio 01 31 jpg 01 35 gif 01 35 bmp 01 35 xbm 01 35 xpm 01 35 png 01 35 tif 0 1 35 ORACLE SID ORCL ORACLE BASE mydatafile2 app oracle MAIL var spool mail oracle PATH usr kerberos bin usr local bin bin usr bin usr X11R6 bin home oracle bin mydatafile 2 app oracle oracle product 10 2 0 db 1 bin INPUTRC etc inputrc PWD home oracle LANG en US UTF 8 LAMHELPFILE etc lam lam helpfile SSH ASKPASS usr libexec openssh gnome ssh askpass SHLVL 1 HOME home oracle LOGNAME oracle LESSOPEN usr bin lesspipe sh s ORACLE HOME mydatafile2 app oracle oracle product 10 2 0 db 1 G BROKEN FILENAMES 1 bin env oracle guohui6 oracle 注意 LD LIBRARY PATH 变量的设置 PATH 环境变量的设置 PATH usr kerberos bin usr local bin bin usr bin usr X11R6 bin home oracle bin m ydatafile2 app oracle oracle product 10 2 0 db 1 bin LD LIBRARY PATH mydatafile2 app oracle oracle product 10 2 0 db 1 lib usr lib usr l ocal lib 如果设置得不对 将无法正确的调用 proc 预编译工具 也无法正确的链接 proc 预编译需要使用 的头文件 确保数据库连接和 tnsnames ora listener ora 文件的正确配置 这里就不再多说了 代码 oracle guohui6 oracle sqlplus scott tiger orcl SQL Plus Release 10 2 0 1 0 Production on Mon Jul 5 01 16 36 2010 Copyright c 1982 2005 Oracle All rights reserved Connected to Oracle Database 10g Enterprise Edition Release 10 2 0 1 0 Production With the Partitioning OLAP and Data Mining options SQL 我们将用 scott 用户对数据库进行连接并查找表里面的数据 代码 main pc 如下 代码 include include include include int main int argc char argv EXEC SQL BEGIN DECLARE SECTION char uid scott tiger ORCL long userid 0 char username 51 EXEC SQL VAR username IS STRING 51 EXEC SQL END DECLARE SECTION EXEC SQL CONNECT uid if sqlca sqlcode 0 printf connect sucess n else printf connect fail n EXEC SQL DECLARE cur user CURSOR FOR SELECT DEPTNO DNAME FROM DEPT EXEC SQL OPEN cur user while 1 userid 0 strcpy username EXEC SQL FETCH cur user INTO userid username if sqlca sqlcode 1403 break printf userid ld username s n userid username EXEC SQL CLOSE cur user EXEC SQL COMMIT WORK RELEASE EXEC SQL ROLLBACK WORK RELEASE return 0 这里用 scott 用户对数据库发起连接 并查询 dept 表中的数据并打印出来 第一步 预编译 代码 oracle guohui6 proc code proc main pc Pro C C Release 10 2 0 1 0 Production on Mon Jul 5 01 27 37 2010 Copyright c 1982 2005 Oracle All rights reserved System default option values taken from mydatafile2 app oracle oracle product 10 2 0 db 1 precomp admin pcscfg cfg oracle guohui6 proc code 第二步 编译预编译生成的文件 main c oracle guohui6 proc code gcc o tespproc main c I ORACLE HOME precomp public L OR ACLE HOME lib lclntsh oracle guohui6 proc code 测试执行 代码 oracle guohui6 proc code tespproc connect sucess userid 50 username SUPPORT userid 10 username ACCOUNTING userid 20 username RESEARCH userid 30 username SALES userid
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 公司公示告知管理制度
- 国网公司考勤管理制度
- 因病病人健康管理制度
- 单位法人私章管理制度
- 培训材料内部管理制度
- 学校使用甲醇管理制度
- 公司户外衣服管理制度
- 冷冻食品日期管理制度
- 医院体检预约管理制度
- 医疗垃圾隔离管理制度
- 起重机械培训(初训)课件
- 2024-2030年中国外资医院行业发展现状及投资管理模式分析报告
- 【MOOC】推 荐系统-北京大学 中国大学慕课MOOC答案
- 古田会议的课件
- 停车场环境卫生保洁方案
- 食品生产企业食品安全培训
- 《家庭系统排列讲座》课件
- 超抗原在神经退行性疾病治疗中的作用
- 帝国的兴衰:修昔底德战争史学习通超星期末考试答案章节答案2024年
- 4.1 实体与虚空-凝固的音乐 教学设计高中音乐人美版(2019)必修 音乐鉴赏
- 2024中级注册安全工程师职业资格考试(道路运输安全)
评论
0/150
提交评论