文档章节

ODPI-C Installation¶

rootliu
 rootliu
发布于 2017/09/09 22:17
字数 1539
阅读 9
收藏 0
点赞 0
评论 0

ODPI-C Installation

Overview

To use ODPI-C in your own project, download its source from GitHub. A sample Makefile is provided if you wish to build ODPI-C as a shared library. Otherwise, add the ODPI-C source code to your project. On Windows, Visual Studio 2008 or higher is required. On macOS, Xcode 6 or higher is required. On Linux, GCC 4.4 or higher is required.

Projects using ODPI-C require Oracle Client libraries to be installed. The libraries provide the necessary network connectivity allowing applications to access an Oracle Database instance. They also provide basic and advanced connection management and data features to ODPI-C applications.

The simplest Oracle Client is the free Oracle Instant Client. Only the “Basic” or “Basic Light” package is required. Oracle Client libraries are also available in any Oracle Database installation or full Oracle Client installation.

ODPI-C explicitly loads available Oracle Client libraries at runtime. This allows code using ODPI-C to be built only once, and then run using available Oracle Client 11.2, 12.1 or 12.2 libraries. On non-Windows platforms, if no Oracle Client is located in the standard operating system search page (e.g. LD_LIBRARY_PATH), then ORACLE_HOME is searched. If Oracle Client libraries are still not found, the error “DPI-1047: Oracle Client library cannot be loaded” is raised.

The following sections explain how to ensure the Oracle Client is installed and configured correctly on the various platforms so that ODPI-C is able to find it.

ODPI-C has been tested on Linux, Windows and macOS. Other platforms should also work but have not been tested.

Oracle Client and Database Versions

ODPI-C can use Oracle Client 11.2, 12.1 or 12.2 libraries.

Oracle Client libraries allow connection to older and newer databases. In summary, Oracle Client 12.2 can connect to Oracle Database 11.2 or greater. Oracle Client 12.1 can connect to Oracle Database 10.2 or greater. Oracle Client 11.2 can connect to Oracle Database 9.2 or greater. For additional information on which Oracle Database releases are supported by which Oracle client versions, please see Doc ID 207303.1.

Since a single ODPI-C binary can use multiple client versions and access multiple database versions, it is important your application is tested in your intended release environments. Newer Oracle clients support new features, such as the oraaccess.xml external configuration file available with 12.1 or later clients, and session pool enhancements to dead connection detection in 12.2 clients.

The function dpiContext_getClientVersion() can be used to determine which Oracle Client version is in use and the functiondpiConn_getServerVersion() can be used to determine which Oracle Database version a connection is accessing. These can then be used to adjust application behavior accordingly. Attempts to use some Oracle features that are not supported by a particular client/server combination may result in runtime errors. These include:

  • when attempting to access attributes that are not supported by the current Oracle Client library you will get the error “ORA-24315: illegal attribute type”
  • when attempting to use implicit results with Oracle Client 11.2 against Oracle Database 12c you will get the error “ORA-29481: Implicit results cannot be returned to client”
  • when attempting to get array DML row counts with Oracle Client 11.2 you will get the error “DPI-1013: not supported”

Linux

ODPI-C requires Oracle Client libraries, which are found in Oracle Instant Client, or an Oracle Database installation, or in a full Oracle Client installation. The libraries must be either 32-bit or 64-bit, matching your application and ODPI-C library (if one is created separately).

On Linux, ODPI-C first searches for a library called “libclntsh.so” using the standard library search order. If this is not found, it will then search for “libclntsh.so.12.1” and then for “libclntsh.so.11.1” before returning an error.

Oracle Instant Client Zip

To run ODPI-C applications with Oracle Instant Client zip files:

  1. Download an Oracle 11.2, 12.1 or 12.2 “Basic” or “Basic Light” zip file: 64-bit or 32-bit, matching your application architecture.

  2. Unzip the package into a single directory that is accessible to your application. For example:

    mkdir -p /opt/oracle
    cd /opt/oracle
    unzip instantclient-basic-linux.x64-12.2.0.1.0.zip
  3. Install the libaio package with sudo or as the root user. For example:

    sudo yum install libaio

    On some Linux distributions this package is called libaio1 instead.

  4. Set the environment variable LD_LIBRARY_PATH to the appropriate directory for the Instant Client version. For example:

    export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH

    Alternatively, if there is no other Oracle software on the machine that will be impacted, permanently add Instant Client to the runtime link path. For example, with sudo or as the root user:

    sudo sh -c "echo /opt/oracle/instantclient_12_2 > /etc/ld.so.conf.d/oracle-instantclient.conf"
    sudo ldconfig

Oracle Instant Client RPM

To run ODPI-C applications with Oracle Instant Client RPMs:

  1. Download an Oracle 11.2, 12.1 or 12.2 “Basic” or “Basic Light” RPM: 64-bit or 32-bit, matching your application architecture.

  2. Install the downloaded RPM with sudo or as the root user. For example:

    sudo yum install oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm

    Yum will automatically install required dependencies, such as libaio.

  3. Set the environment variable LD_LIBRARY_PATH to the appropriate directory for the Instant Client version. For example:

    export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_LIBRARY_PATH

    Alternatively, if there is no other Oracle software on the machine that will be impacted, permanently add Instant Client to the runtime link path. For example, with sudo or as the root user:

    sudo sh -c "echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf"
    sudo ldconfig

Local Database or Full Oracle Client

ODPI-C applications can use Oracle Client 11.2, 12.1 or 12.2 libraries from a local Oracle Database or full Oracle Client installation.

The libraries must be either 32-bit or 64-bit, matching your application and ODPI-C library (if one is created separately).

  1. Set required Oracle environment variables by running the Oracle environment script. For example:

    source /usr/local/bin/oraenv

    For Oracle XE, run:

    source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh

Windows

ODPI-C requires Oracle Client libraries, which are found in Oracle Instant Client, or an Oracle Database installation, or in a full Oracle Client installation. The libraries must be either 32-bit or 64-bit, matching your application and ODPI-C library (if one is created separately).

On Windows, ODPI-C searches for the Oracle Client library “OCI.dll” using the standard library search order.

Oracle Client libraries require the presence of the correct Visual Studio redistributable.

Oracle Instant Client Zip

To run ODPI-C applications with Oracle Instant Client zip files:

  1. Download an Oracle 11.2, 12.1 or 12.2 “Basic” or “Basic Light” zip file: 64-bit or 32-bit, matching your application architecture.
  2. Unzip the package into a single directory that is accessible to your application.
  3. Set the environment variable PATH to include the path that you created in step 2. For example, on Windows 7, update PATH in Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables -> PATH.

Local Database or Full Oracle Client

The Oracle libraries must be either 32-bit or 64-bit, matching your application and ODPI-C library (if one is created separately).

To run ODPI-C applications using client libraries from a local Oracle Database (or full Oracle Client) 11.2, 12.1 or 12.2 installation:

  1. Set the environment variable PATH to include the path that contains OCI.dll, if it is not already set. For example, on Windows 7, updatePATH in Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables -> System Variables -> PATH.

macOS

ODPI-C requires Oracle Client libraries, which are found in Oracle Instant Client for macOS.

On macOS, ODPI-C first searches for a library called “libclntsh.dylib” using the standard library search order. If this is not found, it will then search for “libclntsh.dylib.12.1” and then for “libclntsh.dylib.11.1” before returning an error.

Oracle Instant Client Zip

To run ODPI-C applications with Oracle Instant Client zip files:

  1. Download the 11.2 or 12.1 “Basic” or “Basic Light” zip file from here. Choose either a 64-bit or 32-bit package, matching your application architecture. Most applications use 64-bit.

  2. Unzip the package into a single directory that is accessible to your application. For example:

    mkdir -p /opt/oracle
    unzip instantclient-basic-macos.x64-12.1.0.2.0.zip
  3. Add links to $HOME/lib to enable applications to find the library. For example:

    mkdir ~/lib
    ln -s /opt/oracle/instantclient_12_1/libclntsh.dylib.12.1 ~/lib/

    Alternatively, copy the required OCI libraries. For example:

    mkdir ~/lib
    cp /opt/oracle/instantclient_12_1/{libclntsh.dylib.12.1,libclntshcore.dylib.12.1,libons.dylib,libnnz12.dylib,libociei.dylib} ~/lib/

    For Instant Client 11.2, the OCI libraries must be copied. For example:

    mkdir ~/lib
    cp /opt/oracle/instantclient_11_2/{libclntsh.dylib.11.1,libnnz11.dylib,libociei.dylib} ~/lib/

Other Platforms

To run ODPI-C applications on other platforms (such as Solaris and AIX), follow the same general directions as for Linux Instant Client zip files or Local Database. Add the Oracle libraries to the appropriate library path variable, such as LD_LIBRARY_PATH on Solaris, or LIBPATH on AIX.

本文转载自:https://oracle.github.io/odpi/doc/installation.html

共有 人打赏支持
rootliu
粉丝 2
博文 225
码字总数 2796
作品 0
海淀
数据库管理员
Phalcon Developer Tools on Windows

These steps will guide you through the process of installing Phalcon Developer Tools for Windows. Prerequisites¶ The Phalcon PHP extension is required to run Phalcon Tools. If......

mickelfeng ⋅ 2013/07/06 ⋅ 0

如何在Windows中安装Wt

来自:http://redmine.webtoolkit.eu/projects/wt/wiki/InstallingWtonMSWindows Installing Wt on MS Windows¶〔原文拷贝,锚链不要点 :-)〕 This HOWTO assumes you have a clean Window......

zhmsong ⋅ 2010/07/31 ⋅ 0

如何在Windows中安装Wt

来自:http://redmine.webtoolkit.eu/projects/wt/wiki/InstallingWtonMSWindows Installing Wt on MS Windows¶ 〔原文拷贝,锚链不要点 :-)〕 Installing Wt on MS Windows Setting up you......

zhmsong ⋅ 2010/08/24 ⋅ 0

天涯服务器管理系统(C/S版) 官方说明

一个用于管理服务器的运维软件,可以很方便管理上千台Linux服务器。 一、开发包¶ Client¶ python 2.5 + wxpython2.8+ rpyc3.0+ psyco 1.6+ MySQLdb ConfigParser pywin32 for py2.5 (wind...

renwofei423 ⋅ 2010/06/08 ⋅ 4

天涯服务器管理系统手机版官方说明

天涯服务器管理系统手机版,C/S版托管地址:http://code.google.com/p/tianyaservmanager 一、开发包¶ Client¶ python 2.4 pys60 Server¶ func certmaster cfengine mysql5.0+ rpyc3.0+ ......

renwofei423 ⋅ 2010/06/08 ⋅ 1

eclipse 在debug模式下 报出javax.imageio.IIOException: Can't create cache file!

系统环境:win8 开发环境:java-jdk1.7+tomcat7+eclipse+mysql 在登录页面绘制验证码时,eclipse启动tomcat没有问题。 但是采用debug模式启动tomcat时报错。 Caused by: javax.imageio.IIOEx...

豆豆4997 ⋅ 2014/10/29 ⋅ 0

MakeFiles基本使用指南

下面的内容是直接从我的ipython notebook中摘录出来的所以可能不是很清楚,如果想查看完整版本以及例子,可以访问: git地址: git@github.com:liangz0707/WTF-makefile.git 下载地址:https...

人型电脑天使心 ⋅ 2015/10/17 ⋅ 0

自动化运维工具安装部署 chef (七)troubleshooting

这就是401认证错误 401“未经授权”的错误有多种原因,所以请使用下面的章节来找到最接近您的输出的错误消息。如果您无法找到匹配的错误,或者如果所提供的步骤无效,请提交帮助票。 Failed...

pcdog ⋅ 03/21 ⋅ 0

DCMTK3.6.0(MD支持库)安装过程中通过CMake编译时出现的问题

错误如下: 点击Configure出现错误弹窗 Check for working C compiler using: Visual Studio 10 Win64 Check for working C compiler using: Visual Studio 10 Win64 -- broken CMake Error ......

qt_plus ⋅ 2016/11/22 ⋅ 0

vim入门技巧

內容目录 vim入门技巧 一开始的时候需要知道的东东 查找的技巧 有关使用 搜索 和 C_] 进行查找时单词的区分设定 寄存器的使用 标记缓冲区 搜索时忽略大小写 vim中cscope的使用 有关显示行号的...

首席执行官机器人 ⋅ 02/06 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

win10怎么彻底关闭自动更新

win10自带的更新每天都很多,每一次下载都要占用大量网络,而且安装要等得时间也蛮久的。 工具/原料 Win10 方法/步骤 单击左下角开始菜单点击设置图标进入设置界面 在设置窗口中输入“服务”...

阿K1225 ⋅ 今天 ⋅ 0

Elasticsearch 6.3.0 SQL功能使用案例分享

The best elasticsearch highlevel java rest api-----bboss Elasticsearch 6.3.0 官方新推出的SQL检索插件非常不错,本文一个实际案例来介绍其使用方法。 1.代码中的sql检索 @Testpu...

bboss ⋅ 今天 ⋅ 0

informix数据库在linux中的安装以及用java/c/c++访问

一、安装前准备 安装JDK(略) 到IBM官网上下载informix软件:iif.12.10.FC9DE.linux-x86_64.tar放在某个大家都可以访问的目录比如:/mypkg,并解压到该目录下。 我也放到了百度云和天翼云上...

wangxuwei ⋅ 今天 ⋅ 0

PHP语言系统ZBLOG或许无法重现月光博客的闪耀历史[图]

最近在写博客,希望通过自己努力打造一个优秀的教育类主题博客,名动江湖,但是问题来了,现在写博客还有前途吗?面对强大的自媒体站点围剿,还有信心和可能型吗? 至于程序部分,我选择了P...

原创小博客 ⋅ 今天 ⋅ 0

IntelliJ IDEA 2018.1新特性

工欲善其事必先利其器,如果有一款IDE可以让你更高效地专注于开发以及源码阅读,为什么不试一试? 本文转载自:netty技术内幕 3月27日,jetbrains正式发布期待已久的IntelliJ IDEA 2018.1,再...

Romane ⋅ 今天 ⋅ 0

浅谈设计模式之工厂模式

工厂模式(Factory Pattern)是 Java 中最常用的设计模式之一。这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式。 在工厂模式中,我们在创建对象时不会对客户端暴露创建逻...

佛系程序猿灬 ⋅ 今天 ⋅ 0

Dockerfile基础命令总结

FROM 指定使用的基础base image FROM scratch # 制作base image ,不使用任何基础imageFROM centos # 使用base imageFROM ubuntu:14.04 尽量使用官方的base image,为了安全 LABEL 描述作...

ExtreU ⋅ 昨天 ⋅ 0

存储,对比私有云和公有云的不同

导读 说起公共存储,很难不与后网络公司时代的选择性外包联系起来,但尽管如此,它还是具备着简单和固有的可用性。公共存储的名字听起来也缺乏专有性,很像是把东西直接堆放在那里而不会得到...

问题终结者 ⋅ 昨天 ⋅ 0

C++难点解析之const修饰符

C++难点解析之const修饰符 c++ 相比于其他编程语言,可能是最为难掌握,概念最为复杂的。结合自己平时的C++使用经验,这里将会列举出一些常见的难点并给出相应的解释。 const修饰符 const在c...

jackie8tao ⋅ 昨天 ⋅ 0

聊聊spring cloud netflix的HystrixCommands

序 本文主要研究一下spring cloud netflix的HystrixCommands。 maven <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-clo......

go4it ⋅ 昨天 ⋅ 0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部