青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

拂曉·明月·彎刀

觀望,等待只能讓出現的機會白白溜走

  C++博客 :: 首頁 ::  :: 聯系 :: 聚合  :: 管理 ::

Oracle Database Development (6). A first exploration of OCI

Vert Melon

Jun 25,2007

1.Preface

 Last time , i provided a full example of OCI , which contains the actual code of connection 
and SQL . Certainly it could not cover all of the knowledge , but i think it is a good beginning 
for the fresher .

 As the same as Pro*C you might confirm that you have installed it correctly .  Look at this 
paths as follows :
 
 Windows   :   $ORACLE_HOME\oci
 Linux/Unix  :   $ORACLE_HOME/rdbms/demo
 
 There are many examples offered by ORACLE . Though it seems like a clutter , you also 
can get some useful imformation .

 The main platform we use here is Linux .  And the Windows ?  How can i config it in Windows ? 
It would be a comfy thing if you have read the chapters recorded in  <Oracle Database Development (1). Config OCI In Windows> .
It is easily comprehend by analogy .


2.Something you should know

 What is the Oracle Call Interface?

 The Oracle Call Interface (OCI) is a set of low-level APIs (Application Programming Interface Calls) 
used to interact with Oracle databases. It allows one to use operations like logon, execute, 
parse, fetch, etc. OCI programs are normally written in C or C++, although they can be written
in almost any programing language. Unlike with the Oracle Precompilers (like Pro*C and Pro*COBOL), 
OCI programs are not precompiled.

 Also I have found a official explaination about the choice between Pro*C and OCI .
 
 Should one use OCI or the Oracle Precompilers?
 
 OCI is superior to Pro*C in the following ways: 
  Performance is much better with OCI 
  Reduced code size 
  Direct access to built-in functions (No intermediate files or substitutions). 
  Piecewise Operation on LONG fields (All LONG field problems are solved) 
  In Pro*C one cannot dynamically allocate memory to be used as bind variables 
  You cannot control the Pro*C precompiler to provide better and more compilable C-code. 
  ...
   
 Common problems with OCI: 
  OCI code is difficult to write and to maintain 
  Very few people can write, let alone maintain OCI code 
  ...
  
 An OCI application program must do the following: 
  Connect to one or more databases: call the OCILogon (olog, olon or orlon) routines 
  Open the cursors needed by the program: use oexec, oexn, ofen or oftech calls. 
  Process the SQL statements that are needed to perform the application's tasks. 
  Close the cursors using the oclose routine. 
  Disconnect from the databases: use ologoff to close an open connection to oracle.  

3.Obsolescent OCI Routines

 After get through the section "Something you should know" ,  you may find some strange 
words : oexec , ologoff  or oclose . There are old routines in preceding release . 
 Release 8.0 of the Oracle Call Interface introduced an entirely new set of functions which 
were not available in release 7.3. Release 8.1 added more new functions. Oracle9i OCI continues 
to support these new functions, and adds more new calls. The earlier 7.x calls are still available, 
but Oracle strongly recommends that existing applications use the new calls to improve performance 
and provide increased functionality.
 To get more information ,  check it in the chapter named "Introduction and Upgrading" in 
OCI document .


4. Introduce to OCI Makefile

 It's time to make out the source file , and the first one is Makefile which is a trunk in a project .
But then it is the end of  a first exploration .

 Notice that the head files of OCI are put in two directories and the lib file is libclntsh.so.9.0 
which is the same as Pro*C .  This is a simple one ,  just copy the code in last article and 
divide into the corresponding files as the list . Then use "make all" or "make clean" to deal with 
the source file automaticly . You would see something like this .

[root@liwei oci]# make clean;
rm -f OCIDB OCIDB.o OCIException.o Exception.o OCIError.o Main.o
[root@liwei oci]# make all;
[OCIDB.o]
---------------------
g++ -g -o OCIDB.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c OCIDB.cpp

[OCIException.o]
---------------------
g++ -g -o OCIException.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c OCIException.cpp

[Exception.o]
---------------------
g++ -g -o Exception.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c Exception.cpp

[OCIError.o]
---------------------
g++ -g -o OCIError.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c OCIError.cpp

[Main.o]
---------------------
g++ -g -o Main.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c Main.cpp

[link] ... 
---------------------
g++ -g -o OCIDB OCIDB.o OCIException.o Exception.o OCIError.o Main.o -L/home/ora/ora9/oracle/lib -lclntsh

 That's good . Take a rest for next step .

-------------------------------------------------------------------------------------------------------

Oracle數據庫開發(六).OCI應用初探

草木瓜

2007.6.25  
 
一、序

 在上一次,我提供了一個完整的OCI示例,內容包括數據庫連接和SQL操作的實際代碼。
當然一個小例子不可能包括所有內容,不過我認為對初學者是一個不錯的開始。

 與Pro*C一樣,需要確認安裝OCI組件,查看下面的路徑:
 
 Windows   :   $ORACLE_HOME\oci
 Linux/Unix  :   $ORACLE_HOME/rdbms/demo
 
 這些目錄包含一些由ORACLE提供的一些示例。雖然有些雜亂,不過還是一些幫助的。
 我們這里使用的主要平臺是Linux。 Windows下怎么設置呢?可以參見《Oracle數據庫
開發(一).Windows下配置使用ProC》一文,都是類似的。


二、一些你需要知道的東西

 OCI是什么 ?
 
 OCI是一組底層的API(應用程序接口),主要和Oracle數據庫進行交互。你可以調用一些
操作如 logon , execute, parse, fecth 等等。OCI支持大數據語言,通常使用C/C++。與Oracle
Pro*C等不同,OCI不需要預編譯。

 我這里也找著一份關于在Pro*C和OCI之間選擇的官方說明。
 
 我應該使用OCI還是Pro*C?
 
 OCI比Pro*C的一些優勢:
  
  OCI的性能十分出色
  代碼大量縮減
  對內置函數直接訪問
  對LONG類型的分段操作(可以處理LONG相關的任何錯誤)
  Pro*C不能為綁定變量動態分配內存
  不能控制Pro*C自動生成的代碼 
  
 OCI開發的一些常見問題:
 
  OCI代碼不容易掌握
  ...
  
 OCI開發流程:
 
  連接多個數據庫:使用OCILogon (olog, olon or orlon)
  打開游標:oexec, oexn, ofen 或者 oftech
  執行相應SQL語句
  關于游標:oclose
  斷開連接:ologoff
  
三、廢棄的一些程序標準

 看過上節,你會發現一些奇怪的單詞,oexec , ologoff  或 oclose 。這些都是先前版本
舊的OCI標準。

 OCI 8.0 引入一套全新的程序結構,是7.3以前沒有的。8.1版本又擴展了一些函數。
在Oracle 9i中雖然支持這些舊的標準,不過Oracle強烈建議使用全新的OCI標準庫。
 參考OCI文檔中"介紹和升級內容"一節,獲取更多信息。
 
四、OCI Makefile 介紹

 現在差不多該介紹源代碼了,首先的是Makefile文件,可以說成是整個項目的中心,參
看例中的文件內容。注意頭文件目錄有兩個,庫文件和Pro*C使用的一樣,還是 libclntsh.so.9.0 ,
相關路徑自已調整。
 這個Makefile比較簡單,把前面文章羅列的所有代碼復制并建立相應文件,使用"make all"
"make clean" 命令,你應該能看到如下類似的內容: 

[root@liwei oci]# make clean;
rm -f OCIDB OCIDB.o OCIException.o Exception.o OCIError.o Main.o
[root@liwei oci]# make all;
[OCIDB.o]
---------------------
g++ -g -o OCIDB.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c OCIDB.cpp

[OCIException.o]
---------------------
g++ -g -o OCIException.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c OCIException.cpp

[Exception.o]
---------------------
g++ -g -o Exception.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c Exception.cpp

[OCIError.o]
---------------------
g++ -g -o OCIError.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c OCIError.cpp

[Main.o]
---------------------
g++ -g -o Main.o -I/home/ora/ora9/oracle/rdbms/demo -I/home/ora/ora9/oracle/rdbms/public -c Main.cpp

[link] ... 
---------------------
g++ -g -o OCIDB OCIDB.o OCIException.o Exception.o OCIError.o Main.o -L/home/ora/ora9/oracle/lib -lclntsh

 Makefile相關知識可以去Google一下,文章從現在開始,就要陸續介紹一些OCI
實質性的內容了。

posted on 2011-03-23 00:11 一路風塵 閱讀(600) 評論(0)  編輯 收藏 引用 所屬分類: Oracle
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产日韩欧美精品| 国产精品视频精品视频| 欧美美女视频| 国内一区二区三区在线视频| 亚洲性夜色噜噜噜7777| 欧美福利一区二区三区| 欧美在线啊v一区| 欧美国产日本在线| 亚洲欧洲日韩综合二区| 亚洲美女av网站| 最新中文字幕一区二区三区| 亚洲免费小视频| 欧美私人啪啪vps| 亚洲精品一区二区三区99| 你懂的国产精品永久在线| 久久电影一区| 国产一级久久| 久久久久国产一区二区三区四区| 亚洲一区二区三区中文字幕 | 久久福利资源站| 国产欧美精品va在线观看| 性18欧美另类| 欧美在线国产精品| 在线观看日韩av| 欧美激情久久久| 欧美精品免费播放| 亚洲一区二区精品视频| 亚洲一区在线观看免费观看电影高清| 国产精品蜜臀在线观看| 久久免费视频这里只有精品| 久久久中精品2020中文| 亚洲国产日韩欧美在线图片 | 欧美一级在线亚洲天堂| 黄色欧美日韩| 欧美国产三区| 欧美日韩国产在线播放网站| 亚洲一区二区三区精品在线 | 国产精品色在线| 久久精品中文字幕免费mv| 久久精品国产亚洲5555| 亚洲国产精品久久人人爱蜜臀| 亚洲韩国青草视频| 欧美性猛交视频| 久久久久**毛片大全| 久久综合99re88久久爱| av不卡免费看| 校园春色国产精品| 91久久中文| 亚洲欧美日韩精品久久久久| 亚洲国产精品激情在线观看| 亚洲精品在线观| 国产亚洲日本欧美韩国| 亚洲黄页一区| 国产一区二区三区黄| 亚洲大胆视频| 国产精品久久久久久妇女6080| 久色婷婷小香蕉久久| 欧美色欧美亚洲另类七区| 久久久久久久精| 欧美日本精品一区二区三区| 久久成人一区| 欧美日韩国产成人| 久久综合久久久久88| 欧美日在线观看| 欧美成人国产| 国产精品永久| 91久久夜色精品国产网站| 久久蜜桃香蕉精品一区二区三区| 欧美性猛交xxxx乱大交退制版 | 久久夜色精品国产| 欧美日本免费| 欧美69wwwcom| 国产亚洲成精品久久| 99亚洲伊人久久精品影院红桃| 在线成人www免费观看视频| 在线综合亚洲欧美在线视频| 亚洲美洲欧洲综合国产一区| 久久久精品国产一区二区三区| 性欧美xxxx视频在线观看| 欧美日韩网站| 亚洲精品国精品久久99热一| 亚洲国产视频a| 久久久久在线| 久久婷婷国产综合尤物精品| 国产免费成人av| 亚洲视频999| 亚洲一区二区三区欧美| 欧美区在线观看| 亚洲人成人77777线观看| 亚洲欧洲精品一区| 你懂的视频欧美| 亚洲第一免费播放区| 亚洲国产专区校园欧美| 久热精品视频在线免费观看| 麻豆视频一区二区| 亚洲国产婷婷综合在线精品 | 伊大人香蕉综合8在线视| 性欧美xxxx视频在线观看| 西西人体一区二区| 国产亚洲成人一区| 久久先锋资源| 亚洲国产天堂久久综合| 日韩视频免费| 欧美日韩在线一区二区| 亚洲视频成人| 久久久久这里只有精品| 在线观看国产日韩| 欧美精品二区三区四区免费看视频| 亚洲电影中文字幕| 日韩视频中文| 国产精品v日韩精品v欧美精品网站| 中国成人黄色视屏| 欧美在线观看日本一区| 黄色国产精品| 欧美看片网站| 欧美一区综合| 亚洲高清在线观看| 亚洲视频一区二区在线观看| 国产精品乱码久久久久久| 欧美一区二区三区四区夜夜大片 | 亚洲午夜久久久久久久久电影网| 国产精品久久久999| 欧美专区一区二区三区| 亚洲国产精品一区二区尤物区| 亚洲一级在线| 永久久久久久| 欧美日韩国产一区二区三区地区| 亚洲综合日韩在线| 欧美成人按摩| 一区二区在线观看视频| 亚洲人成网站色ww在线| 午夜精品影院| 亚洲福利视频免费观看| 欧美三级电影大全| 久久精品视频免费| 99视频+国产日韩欧美| 久久久噜噜噜久久人人看| 亚洲人www| 国产日韩精品一区二区三区 | 国产精品一区二区黑丝| 久久这里只有精品视频首页| 一本色道久久综合精品竹菊| 久久精品九九| 一区二区免费看| 亚洲电影免费观看高清| 国产精品亚洲综合色区韩国| 欧美成人综合在线| 欧美在线二区| 亚洲无玛一区| 亚洲毛片av在线| 欧美激情视频一区二区三区免费| 欧美一区91| 一本久久知道综合久久| 激情久久久久久久| 国产精品久久久久毛片软件 | 中国av一区| 亚洲日本欧美在线| 老司机免费视频一区二区三区| 亚洲综合第一页| av成人毛片| 91久久精品一区| 黄色小说综合网站| 国产精品午夜春色av| 欧美日韩一区二区三| 欧美成人精品1314www| 久久天天躁狠狠躁夜夜爽蜜月| 欧美亚洲日本网站| 先锋影院在线亚洲| 午夜精品视频| 亚洲在线视频免费观看| 99精品国产在热久久婷婷| 亚洲国产精品一区二区www| 免费人成网站在线观看欧美高清| 久久精品国产免费看久久精品| 亚洲一区999| 亚洲欧美日韩一区二区| 亚洲欧美日韩一区二区三区在线观看| 日韩一级免费观看| 99这里只有久久精品视频| 亚洲理伦在线| 99re亚洲国产精品| 一区二区国产日产| 亚洲欧美日本日韩| 欧美淫片网站| 久久综合网hezyo| 欧美69视频| 亚洲电影免费观看高清完整版在线| 免费在线观看一区二区| 男同欧美伦乱| 亚洲电影免费在线 | 亚洲男人的天堂在线观看| 在线视频你懂得一区| 亚洲视频一二| 亚洲欧美日韩国产综合在线 | 好吊日精品视频| 激情综合五月天| 国产亚洲精品v| 尤物yw午夜国产精品视频明星| 亚洲大黄网站| 99综合精品|