zoukankan      html  css  js  c++  java
  • Linux中Oracle 11g Proc*C开发环境搭建

    使proc预编译命令可用:

    [karihou@bogon ~]$ cat ~/.bash_profile
    # .bash_profile
    
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    
    # User specific environment and startup programs
    
    PATH=$PATH:$HOME/bin
    
    export PATH
    export ORACLE_BASE=/home/karihou/app/karihou
    export ORACLE_HOME=/home/karihou/app/karihou/product/11.2.0/dbhome_1
    export ORACLE_SID=orcl
    export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:$LD_LIBRARY_PATH

    配置pcscfg.cfg文件:

    [karihou@bogon admin]$ view pcscfg.cfg
    sys_include=($ORACLE_HOME/precomp/public,/usr/include,/usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/include,/usr/lib/gcc/x86_64-redhat-linux/4.1.1/include,/usr/lib64/gcc/x86_64-suse-linux/4.1.2/include,/usr/lib64/gcc/x86_64-suse-linux/4.3/include,/usr/lib/gcc/x86_64-redhat-linux/4.4.4/include)
    ltype=short
    define=__x86_64__
    #以下为手动添加环境变量
    include=($ORACLE_HOME/precomp/public)
    include=$ORACLE_HOME/precomp/hdrs
    include=$ORACLE_HOME/tpcc2x_2/src
    include=$ORACLE_HOME/precomp/precomp/include
    include=$ORACLE_HOME/precomp/oracore/include
    include=$ORACLE_HOME/precomp/oracore/public
    include=$ORACLE_HOME/precomp/rdbms/include
    include=$ORACLE_HOME/precomp/rdbms/public
    include=$ORACLE_HOME/precomp/rdbms/demo
    include=$ORACLE_HOME/precomp/nlsrtl/include
    include=$ORACLE_HOME/precomp/nlsrtl/public
    include=$ORACLE_HOME/precomp/network_src/include
    include=$ORACLE_HOME/precomp/network_src/public
    include=$ORACLE_HOME/precomp/network/include
    include=$ORACLE_HOME/precomp/network/public
    include=$ORACLE_HOME/precomp/plsql/public
    ltype=short

    测试源码:

    [root@bogon ~]$ cat login.pc
    #include <stdio.h> 
    #include <stdlib.h>  
    #include <string.h>  
      
    EXEC SQL INCLUDE sqlca;  
      
    EXEC SQL BEGIN DECLARE SECTION;  
    varchar username[20];  
    varchar password[20];  
    EXEC SQL END DECLARE SECTION;  
      
    int  
    main(void)  
    {  
        strcpy(username.arr, "karihou");  
        username.len = strlen("karihou");  
        strcpy(password.arr, "1");  
        password.len = strlen("1");  
      
        EXEC SQL CONNECT :username IDENTIFIED BY :password;  
        if(sqlca.sqlcode == 0){  
            printf("login success
    ");  
        }else{  
            printf("login failed
    ");  
        }  
      
        exit(0);  
    }
  • 相关阅读:
    MySQL for OPS 02:SQL 基础
    Samba:基于公网 IP 的服务访问
    MySQL for OPS 01:简介 / 安装初始化 / 用户授权管理
    Samba:打造企业级授权文件共享服务器
    嵌入式web server——Goahead移植要点
    libConfuse的使用
    【工具篇】notepad++
    使用sprintf打印float并控制小数位数时引起的问题
    【工具篇】source Insight
    【工具篇】xshell
  • 原文地址:https://www.cnblogs.com/RaymondBlog/p/6543988.html
Copyright © 2011-2022 走看看