⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 otl方式 访问oracle9i数据库 需要用otlv4.h
💻 CPP
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -