文档章节

cx_Oracle - Python Interface for Oracle Database

rootliu
 rootliu
发布于 2017/09/09 13:35
字数 744
阅读 13
收藏 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
博文 244
码字总数 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) 配置环境变量 Note:这里的DYLDLIBRARYPATH需...

亚林瓜子
08/03
0
0
【转载】50个很棒的Python模块

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

甜菜萧
2011/02/13
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

没有更多内容

加载失败,请刷新页面

加载更多

下一页

文件的压缩与解压(linux)

Linux下*.tar.gz文件解压缩命令 1.压缩命令:   命令格式:tar -zcvf 压缩后文件名.tar.gz 被压缩文件名 可先切换到当前目录下。压缩文件名和被压缩文件名都可加入路径。 2.解压缩命令: ...

qimh
24分钟前
1
0
invalid character found in the request target 异常

这个异常时因为Tomcat 9不支持请求格式出现“{”等非法字符的问题 因为tomcat版本问题遇到的坑,记录一下。 问题 今天由于要测试一下订单详情页的异步查询,在本地起了一个服务,发送的请求是...

edwardGe
28分钟前
1
0
发现抓包软件fiddler的bug

1个请求他跳转之后,直接400,被拦在了Apache,使用fiddler 的,replay requests 是同样的结果,但是replay composer确是正常的。 也就是说这replay requests 是发原来的包,replay composer...

NLGBZJ
38分钟前
1
0
linux screen 命令详解

shell关闭后, 主机仍然运行 screen命令 启动jenkins以后, screen, 然后按ctrl+a 再按d 这样暂停了子界面, 这时候回到了父界面 用screen –ls查看目前子界面的状态 [root@free /]# screen -l...

SuShine
39分钟前
1
0
mac机器切换无线网络导致网页不能打开的问题

问题: 公司和家里使用不同的WI-FI,每次从家到公司时自动切换网络后,公司的许多地址不能访问, ping域名是可以ping同的,但是网页却打不开... 问题分析: 初步猜想是DNS缓存的问题? 对于MAC系统没...

Lennie002
42分钟前
1
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部