Oracle, Odbc and DB2-CLI Template Library(OTL)使用方法

來源:互聯網
上載者:User
OTL使用方法1        來源http://otl.sourceforge.net/http://otl.sourceforge.net/otlv4_h.zip(2005-8-17)2        安裝2.1          Windows XP,VC6.0,Oracle8.1.61)        將下載的安裝包解壓成C:/Program Files/Microsoft Visual Studio/VC98/otlv4_h/otlv4.h。2)        在VC下Tools->Options->Directories->Include files添加C:/PROGRAM FILES/MICROSOFT VISUAL STUDIO/VC98/OTLV4_H。如果沒有設定OCI路徑的話,還需要3)        在VC下Tools->Options->Directories->Include files添加C:/ORACLE/ORA81/OCI/INCLUDE。4)        在VC下Tools->Options->Directories->Library files添加C:/ORACLE/ORA81/OCI/LIB/MSVC。2.2          Unix Solaris,gcc,Oracle9.2將下載的安裝包解壓即可。3        測試3.1          Windows XP,VC6.0,Oracle8.1.61)        建立一個控制台空工程,類型選擇為Win32 Console Application,Finish即可。2)        在Project->Settings->Link->Object/library modules下填入oci.lib。3)        將otl4_examples/ ex10_oci8.cpp拷貝到該工程目錄下。4)        在Workspace視窗的FileView頁,按右鍵***files,在彈出的菜單上選擇Add Files to Project,將ex10_oci8.cpp添加進來。5)        修改來源程式如下:

#include <iostream>//using namespace std;#include <stdio.h> #define OTL_ORA8I // Compile OTL 4/OCI8#include <otlv4.h> // include the OTL 4 header fileusing namespace std;‘……int main(){ otl_connect::otl_initialize(); // initialize OCI environment try{   db.rlogon("username/password@sid"); // connect to Oracle 
圖 0‑1 修改後的原始碼3.2          Unix Solaris,gcc,Oracle9.21)        將ex10_oci8.cpp拷貝到一個目錄下。2)        修改源檔案,如下:

#include <iostream>using namespace std;#include <stdio.h> #define OTL_ORA8I // Compile OTL 4/OCI8#include “otlv4.h” // include the OTL 4 header fileusing namespace std;‘……int main(){ otl_connect::otl_initialize(); // initialize OCI environment try{   db.rlogon("username/password@sid"); // connect to Oracle 
圖 0‑1 修改後的原始碼3)        編寫Makefile檔案,樣本:

all : ex10_oci8.cpp        g++  ex10_oci8.cpp /        -I${ORACLE_HOME}/rdbms/demo -I${ORACLE_HOME}/rdbms/public -I${ORACLE_HOME}/network/public /        -L${ORACLE_HOME}/lib32 -lclntsh
圖 0‑2 Makefile樣本

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.