main.cpp

来自「otl方式 访问oracle9i数据库 需要用otlv4.h」· C++ 代码 · 共 36 行

CPP
36
字号
#include <iostream> 
using namespace std; 
#include <stdio.h> 

#define OTL_ORA9I // Compile OTL 4.0/OCI9i 
#define OTL_ORA_TIMESTAMP // enable Oracle 9i TIMESTAMPs [with [local] time zone] 
#include "otlv4.h" // include the OTL 4.0 header file 

otl_connect db; // connect object 


int main() 
{ 
    otl_connect::otl_initialize(); // initialize OCI environment  
    try 
    { 
        db.rlogon("scott/tiger@ORACLE9I"); // connect to Oracle  
        cout<<"Connect to Database"<<endl; 
    } 
    catch(otl_exception& p) 
    {  
        // intercept OTL exceptions  
        cerr<<p.msg<<endl; // print out error message  
        cerr<<p.stm_text<<endl; // print out SQL that caused the error  
        cerr<<p.sqlstate<<endl; // print out SQLSTATE message  
        cerr<<p.var_info<<endl; // print out the variable that caused the error  
    } 
  

    db.logoff(); // disconnect from Oracle 


    return 0; 
} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?