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

拂曉·明月·彎刀

觀望,等待只能讓出現(xiàn)的機會白白溜走

  C++博客 :: 首頁 ::  :: 聯(lián)系 :: 聚合  :: 管理 ::

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數(shù)據(jù)庫開發(fā)(六).OCI應用初探

草木瓜

2007.6.25  
 
一、序

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

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


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

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

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

 看過上節(jié),你會發(fā)現(xiàn)一些奇怪的單詞,oexec , ologoff  或 oclose 。這些都是先前版本
舊的OCI標準。

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

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

[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一下,文章從現(xiàn)在開始,就要陸續(xù)介紹一些OCI
實質(zhì)性的內(nèi)容了。

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>
            亚洲日本久久| ●精品国产综合乱码久久久久| 久久综合色婷婷| 亚洲另类在线视频| 国产视频亚洲精品| 欧美日韩精品免费观看视频完整 | 久久综合色婷婷| 亚洲国产日韩欧美在线图片| 韩日欧美一区二区| 亚洲在线成人| 91久久国产综合久久91精品网站| 国语自产精品视频在线看抢先版结局 | 欧美在线关看| 国产精品爱久久久久久久| 亚洲电影免费| 99成人精品| 欧美视频一区二区三区四区| 日韩亚洲精品在线| 亚洲日本电影| 欧美黄色小视频| 亚洲日本电影| 亚洲精品你懂的| 欧美日韩国产一区二区三区地区| 美女视频黄免费的久久| 一区二区视频免费在线观看| 国产精品资源| 国产美女精品| 国产精品午夜在线| 亚洲大胆女人| 欧美大片在线看| 蜜臀a∨国产成人精品| 久久精品一二三| 久久米奇亚洲| 久久久久久久一区二区| 日韩一二三区视频| 久久久久久自在自线| 欧美小视频在线| 亚洲免费视频一区二区| 新67194成人永久网站| 久久久精品国产免费观看同学 | 欧美精品一区二区三区四区| 欧美专区在线观看| 香蕉尹人综合在线观看| 欧美怡红院视频| 久久永久免费| 国产精品乱码一区二三区小蝌蚪| 99re66热这里只有精品3直播 | 蜜桃久久精品一区二区| 一区二区欧美日韩| aa级大片欧美| 久久国产精品第一页| 亚洲欧美激情视频在线观看一区二区三区 | 日韩性生活视频| 亚洲最新视频在线播放| 欧美日韩亚洲视频一区| 免费视频久久| 欧美日韩亚洲视频| 亚洲欧美在线x视频| 亚洲欧洲日本专区| 国产综合欧美| 欧美高清一区二区| 久久久久久久欧美精品| 久久国产视频网| 午夜精品久久久久影视| 欧美影院在线| 中文国产一区| 国产伦精品一区二区三区高清版| 国产精品爱久久久久久久| 午夜精品福利在线观看| 亚洲日韩视频| 免费在线观看日韩欧美| 欧美精品乱码久久久久久按摩| 国产日韩综合一区二区性色av| 欧美在线免费| 欧美四级在线| 欧美日韩一区二区三区在线视频| 男女视频一区二区| 亚洲国产视频一区| 欧美在线一区二区三区| 欧美一区二区三区喷汁尤物| 国产在线不卡精品| 麻豆精品在线视频| 欧美日韩国产不卡| 欧美午夜视频| 欧美激情1区| 欧美99在线视频观看| 免费不卡在线观看av| 亚洲香蕉成视频在线观看| 久久久久国产免费免费| 亚洲国产欧美日韩| 免费看精品久久片| 欧美激情视频一区二区三区在线播放 | 蜜桃久久av| 快播亚洲色图| 欧美午夜片在线观看| 91久久线看在观草草青青| 久久午夜av| 国产精品剧情在线亚洲| 亚洲狼人综合| 亚洲人体一区| 亚洲人久久久| 国语自产在线不卡| 蜜桃av一区| 久久久人成影片一区二区三区| 国产综合色产| 久久久国产亚洲精品| 欧美激情精品久久久| 亚洲影院免费| 国产欧美一区二区精品仙草咪| 久久国产精品免费一区| 欧美国产日韩一区二区在线观看 | 久久久久一区| 免费视频一区二区三区在线观看| 欧美喷潮久久久xxxxx| 亚洲国产专区| 久久黄色影院| 性色av一区二区三区红粉影视| 国产美女精品视频| 午夜亚洲性色福利视频| 亚洲与欧洲av电影| 国产在线视频不卡二| 久久久久久一区| 洋洋av久久久久久久一区| 欧美诱惑福利视频| 精品成人一区二区三区四区| 久久综合伊人77777麻豆| 久久网站热最新地址| 在线一区二区三区四区| 免费黄网站欧美| 欧美日韩中文精品| 小黄鸭精品密入口导航| 欧美成人综合在线| 中文精品一区二区三区| 欧美日韩视频在线一区二区观看视频| 久久久久久自在自线| 亚洲性感激情| 久久精品视频亚洲| 欧美高清日韩| 欧美jizz19性欧美| 麻豆精品传媒视频| 欧美成在线观看| 久久国产免费看| 欧美亚洲网站| 亚洲欧洲一区二区天堂久久| 精品91在线| 国产欧美视频一区二区| 国产精品老牛| 亚洲影院污污.| 在线综合亚洲| 性欧美video另类hd性玩具| 日韩视频免费观看| 亚洲国产高清在线观看视频| 国产麻豆综合| 国产亚洲欧美日韩美女| 久久国产精品网站| 亚洲国产成人av| 欧美一区二区三区日韩| 亚洲线精品一区二区三区八戒| 91久久久久久| 亚洲人成在线观看一区二区| 国产欧美日韩专区发布| 国产精品国产三级国产普通话三级 | 日韩视频中文字幕| 久久国产精品一区二区三区| 亚洲欧美激情在线视频| 午夜久久tv| 久久成人羞羞网站| 久久久久久噜噜噜久久久精品| 玖玖精品视频| 小辣椒精品导航| 久久理论片午夜琪琪电影网| 久久岛国电影| 久久九九精品99国产精品| 性欧美1819性猛交| 午夜精品国产| 欧美中文在线视频| 欧美一区二区三区四区视频| 亚洲资源av| 亚洲少妇诱惑| 在线亚洲精品福利网址导航| 欧美无砖砖区免费| 欧美电影免费观看高清| 久久婷婷国产综合精品青草 | 欧美一级淫片播放口| 亚洲国产精品嫩草影院| 亚洲欧美日韩精品| 亚洲精品乱码久久久久久日本蜜臀| 国产精品日日摸夜夜添夜夜av| 欧美激情国产精品| 欧美精品系列| 欧美欧美在线| 欧美日产在线观看| 欧美日韩精品系列| 欧美日韩精品一区视频| 欧美三区美女| 一区二区在线视频| 欧美高清视频www夜色资源网| 亚洲欧美日韩一区二区三区在线观看| 欧美一区=区| 亚洲无玛一区|