文档章节

cx_Oracle - Python Interface for Oracle Database

rootliu
 rootliu
发布于 2017/09/09 13:35
字数 744
阅读 15
收藏 0

cx_Oracle - Python Interface for Oracle Database

Documentation · Installation . Release Notes . Source code · Mailing list

cx_Oracle logo

About cx_Oracle

cx_Oracle is a Python extension module that enables access to Oracle Database. It conforms to the Python database API 2.0 specification with a considerable number of additions and a couple of exclusions.

cx_Oracle is licensed under a BSD license which you can find here.

cx_Oracle 6 has been tested with Python version 2.7, and with versions 3.4 and higher. You can use cx_Oracle with Oracle 11.2, 12.1 and 12.2 client libraries. Oracle's standard client-server version interoperability allows connection to both older and newer databases. For example Oracle 12.2 client libraries can connect to Oracle Database 11.2 or later.

Features

  • Easily installed from PyPI.

  • Support for Python 2 and 3.

  • Support for Oracle Client 11.2, 12.1 and 12.2. Oracle's standard cross-version interoperability, allows easy upgrades and connectivity to different Oracle Database versions.

  • Connect to Oracle Database 9.2, 10, 11 or 12 (depending on the Oracle Client version used).

  • SQL and PL/SQL Execution. The underlying Oracle Client libraries have significant optimizations including compressed fetch, pre-fetching, client and server result set caching, and statement caching with auto-tuning.

  • Full use of Oracle Network Service infrastructure, including encrypted network traffic and security features.

  • Extensive Oracle data type support, including large object support (CLOB and BLOB).

  • Direct binding to SQL objects. One great use case is binding Python objects to Oracle Spatial SDO objects.

  • Array operations for efficient INSERT and UPDATEs.

  • Array row counts and batch error handling for array operations.

  • Fetching of large result sets.

  • REF CURSOR support.

  • Support for scrollable cursors. Go back and forth through your query results.

  • Fetch PL/SQL Implicit Results. Easily return query results from PL/SQL.

  • Row Prefetching. Efficient use of the network.

  • Client Result Caching. Improve performance of frequently executed look-up statements.

  • Support for Advanced Queuing. Use database notifications to build micro-service applications.

  • Continuous Query Notification. Get notified when data changes.

  • Support for Edition Based Redefinition. Easily switch applications to use updated PL/SQL logic.

  • Support for setting application context during the creation of a connection, making application metadata more accessible to the database, including in LOGON triggers.

  • End-to-end monitoring and tracing.

  • Transaction Management.

  • Session Pooling.

  • Database Resident Connection Pooling (DRCP).

  • Privileged Connections.

  • External Authentication.

  • Database startup and shutdown.

  • Oracle Database High Availability Features, such as FAN notifications and Transaction Guard support.

DB API specification exclusions: The time data type is not supported by Oracle and is therefore not implemented. The methodcursor.nextset() is not implemented either as the DB API specification assumes an implementation of cursors that does not fit well with Oracle's implementation of cursors and implicit results. See the method cursor.getimplicitresults() for more information.

Installation

See cx_Oracle Installation for detailed instructions.

  • The simplest way to install cx_Oracle is with pip:

    python -m pip install cx_Oracle --upgrade

    If a binary wheel package is not available on PyPI for your platform, the source package will be used.

    Note that if you download a source zip file directly from GitHub then you will also need to download an ODPI-C source zip file and extract it inside the directory called "odpi".

  • After cx_Oracle is installed, Oracle client libraries must also be installed and configured. These can be from Oracle Instant Client, from a local Oracle Database, or from a full Oracle Client installation.

    If you need the libraries, download and unzip the Oracle Instant Client 'Basic' package for your platform and set PATH, LD_LIBRARY_PATH, or similar platform-specific library path loading environment. See the installation notes for ODPI-Cfor help.

    Versions 11.2, 12.1 and 12.2 of the Oracle Client libraries on Linux, Windows and macOS are supported. Users have also reported success with other platforms.

If you require cx_Oracle 5.3, download a Windows installer from PyPI or use python -m pip install cx-oracle==5.3 to install from source.

Very old versions of cx_Oracle can be found in the files section at Sourceforge.

Example

from __future__ import print_function

    import cx_Oracle

    connection = cx_Oracle.connect("hr", "welcome", "localhost/orclpdb")

    cursor = connection.cursor()
    cursor.execute("""
	    SELECT first_name, last_name
	    FROM employees
	    WHERE department_id = :did AND employee_id > :eid""",
	    did = 50,
	    eid = 190)
    for fname, lname in cursor:
	print("Values:", fname, lname)

For more examples, please see the samples and the test suite. You can also look at the scripts in cx_OracleTools and the modules in cx_PyOracleLib.

Documentation

See the cx_Oracle Documentation and Release Notes.

Help

Issues and questions can be raised with the cx_Oracle community on GitHub or on the mailing list.

本文转载自:https://oracle.github.io/python-cx_Oracle/index.html

共有 人打赏支持
rootliu
粉丝 2
博文 252
码字总数 2796
作品 0
海淀
数据库管理员
windows下安装cx_Oracle的方法

Install cx_Oracle Use Python’s Pip package to install cxOracle from PyPI: python -m pip install cx_Oracle --upgrade This will download and install a pre-compiled binary if one ......

良言
07/09
0
0
Python远程连接服务器上的Oracle数据库

Python远程连接服务器上的Oracle数据库 1、正确的开启方式 在你的IPython或者是Anaconda的jupyter中输入一下代码,其中: ‘username’—— 用户名 ‘password’——密码 ‘192.168.1.1:1521/...

推荐码发放
05/04
0
0
mac上安装python3的cx_Oracle数据库驱动

问题 使用Python3 for mac上面的cx_Oracle数据库驱动 步骤 下载Oracle的Instant Client 程序包 Instant Client 下载适用于 Mac OS X (Intel x86) 这里版本的选择,应该根据你访问的oracle库的...

亚林瓜子
08/03
0
0
Linux安装cx_Oracle

1.安装cx_Oracle包 2.官网下载相关依赖包 官网地址:http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html 本人百度网盘链接: https://p......

走马兰台
08/13
0
0
【转载】50个很棒的Python模块

Python具有强大的扩展能力,以下列出了50个很棒的Python模块,包含几乎所有的需要:比如Databases,GUIs,Images, Sound, OS interaction, Web,以及其他。推荐收藏。 Graphical interface wx...

甜菜萧
2011/02/13
0
0

没有更多内容

加载失败,请刷新页面

加载更多

OSChina 周六乱弹 —— 到底谁是小公猫……

Osc乱弹歌单(2018)请戳(这里) 【今日歌曲】 @莱布妮子:分享Trivium的单曲《Throes Of Perdition》 《Throes Of Perdition》- Trivium 手机党少年们想听歌,请使劲儿戳(这里) @小鱼丁:...

小小编辑
今天
160
3
基础选择器

注意:本教程参考自网上流传的李兴华老师的jquery开发框架视频,但是苦于没有相应的配套笔记,由我本人做了相应的整理. 本次学习的内容 学习jquery提供的各种选择器的使用,掌握了jquery选择...

江戸川
今天
1
0
Spring中static变量不能@value注入的原因

今天本想使用@Value的方式使类中的变量获得yml文件中的配置值,然而一直失败,获得的一直为null。 类似于这样写的。 public class RedisShardedPool { private static ShardedJedisPool pool...

钟然千落
今天
2
0
CentOS7防火墙firewalld操作

firewalld Linux上新用的防火墙软件,跟iptables差不多的工具。 firewall-cmd 是 firewalld 的字符界面管理工具,firewalld是CentOS7的一大特性,最大的好处有两个:支持动态更新,不用重启服...

dingdayu
今天
1
0
关于组件化的最初步

一个工程可能会有多个版本,有国际版、国内版、还有针对各种不同的渠道化的打包版本、这个属于我们日常经常见到的打包差异化版本需求。 而对于工程的开发,比如以前的公司,分成了有三大块业...

DannyCoder
今天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部