269 lines
8.7 KiB
HTML
269 lines
8.7 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<title>cx_Oracle - Python Interface for Oracle Database</title>
|
|
<link rel="stylesheet" href="base.css" type="text/css"/>
|
|
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="container">
|
|
<div id="header">
|
|
<h1>cx_Oracle - Python Interface for Oracle Database</h1>
|
|
</div>
|
|
<div id="menu">
|
|
<a href="http://cx-oracle.readthedocs.io/en/latest/index.html">Documentation</a> ·
|
|
<a href="http://cx-oracle.readthedocs.io/en/latest/installation.html" >Installation</a> .
|
|
<a href="http://cx-oracle.readthedocs.io/en/latest/releasenotes.html">Release Notes</a> .
|
|
<a href="https://github.com/oracle/python-cx_Oracle">Source code</a> ·
|
|
<a href="http://lists.sourceforge.net/lists/listinfo/cx-oracle-users">Mailing list</a>
|
|
</div>
|
|
<div id="content">
|
|
<img class="logo" alt="cx_Oracle logo" src="logo.png"/>
|
|
|
|
<div id="description">
|
|
<h2>About cx_Oracle</h2>
|
|
|
|
<p><strong>cx_Oracle</strong> is a Python extension module that
|
|
enables access to Oracle Database. It conforms to the Python
|
|
database API 2.0 <a
|
|
href="http://www.python.org/topics/database/DatabaseAPI-2.0.html">
|
|
specification</a> with a considerable number of additions and a
|
|
couple of exclusions.</p>
|
|
|
|
<p>cx_Oracle is licensed under a BSD license which you can find <a
|
|
href="https://github.com/oracle/python-cx_Oracle/blob/master/LICENSE.txt"
|
|
>here</a>.</p>
|
|
|
|
<p>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.</p>
|
|
|
|
</div> <!-- /description -->
|
|
|
|
<div id="quickstart">
|
|
<h2>Getting Started</h2>
|
|
|
|
<ul>
|
|
|
|
<li><p>Install Python from <a href="https://www.python.org/" >python.org</a>.</p></li>
|
|
|
|
<li><p>Install cx_Oracle using <a href="http://cx-oracle.readthedocs.io/en/latest/installation.html#quick-start-cx-oracle-installation" >Quick Start cx_Oracle Installation</a>.</p></li>
|
|
|
|
<li><p>Download cx_Oracle <a
|
|
href="https://github.com/oracle/python-cx_Oracle/tree/master/samples"
|
|
>samples</a> or create a script like the one below.</p></li>
|
|
|
|
<li><p>Locate your Oracle Database username and password, and the database
|
|
connection string. The connection string is commonly of the format
|
|
<code>hostname/servicename</code>, using the hostname where the database is
|
|
running, and the service name of the Oracle Database instance.</p>
|
|
|
|
<p>Substitute your username, password and connection string in the
|
|
code. For downloaded examples, put these in <a
|
|
href="https://github.com/oracle/python-cx_Oracle/tree/master/samples/SampleEnv.py"
|
|
><code>SampleEnv.py</code></a> and <a
|
|
href="https://github.com/oracle/python-cx_Oracle/blob/master/samples/sql/SampleEnv.sql"
|
|
><code>SampleEnv.sql</code></a>, and then follow <a
|
|
href="https://github.com/oracle/python-cx_Oracle/tree/master/samples/README.md"
|
|
><code>sample/README</code></a> to create the cx_Oracle sample schema.
|
|
SQL scripts to create Oracle Database's common sample schemas can be
|
|
found at <a href="https://github.com/oracle/db-sample-schemas"
|
|
>github.com/oracle/db-sample-schemas</a></p> </li>
|
|
|
|
<li><p>Run the Python script, for example:</p>
|
|
|
|
<pre>
|
|
python myscript.py
|
|
</pre>
|
|
</li>
|
|
</ul>
|
|
|
|
<h4><b>Sample cx_Oracle Script</b></h4>
|
|
<pre>
|
|
from __future__ import print_function
|
|
|
|
import cx_Oracle
|
|
|
|
# Connect as user "hr" with password "welcome" to the "oraclepdb" service running on this computer.
|
|
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)
|
|
</pre>
|
|
|
|
</div> <!-- /quickstart -->
|
|
|
|
<div id="installation">
|
|
<h2>Installation</h2>
|
|
|
|
See <a
|
|
href="http://cx-oracle.readthedocs.io/en/latest/installation.html"
|
|
>cx_Oracle Installation</a> for detailed instructions.
|
|
|
|
</div> <!-- /installation -->
|
|
|
|
<div id="example">
|
|
|
|
<h2>Examples</h2>
|
|
|
|
See the <a
|
|
href="https://github.com/oracle/python-cx_Oracle/tree/master/samples"
|
|
>samples</a> and the <a
|
|
href="https://github.com/oracle/python-cx_Oracle/tree/master/test"
|
|
>test suite</a>. You can also look at the scripts in <a
|
|
href="https://github.com/anthony-tuininga/cx_OracleTools">cx_OracleTools</a>
|
|
and the modules in
|
|
<a href="https://github.com/anthony-tuininga/cx_PyOracleLib">cx_PyOracleLib</a>.
|
|
|
|
</div> <!-- /example -->
|
|
|
|
<div id="documentation">
|
|
<h2>Documentation</h2>
|
|
|
|
See the <a href="http://cx-oracle.readthedocs.io" >cx_Oracle
|
|
Documentation</a>.
|
|
|
|
</div> <!-- /documentation -->
|
|
|
|
<div id="changes">
|
|
<h2>Changes</h2>
|
|
|
|
See <a href="http://cx-oracle.readthedocs.io/en/latest/whatsnew.html"
|
|
>What's New</a> and the <a
|
|
href="http://cx-oracle.readthedocs.io/en/latest/releasenotes.html"
|
|
>Release Notes</a>.
|
|
|
|
</div> <!-- /changes -->
|
|
|
|
<div id="tests">
|
|
<h2>Tests</h2>
|
|
|
|
See the <a href="https://github.com/oracle/python-cx_Oracle/tree/master/test" >test suite</a>.
|
|
|
|
</div> <!-- /tests -->
|
|
|
|
<div id="help">
|
|
<h2>Help</h2>
|
|
|
|
<p>Issues and questions can be raised with the cx_Oracle community on
|
|
<a href="https://github.com/oracle/python-cx_Oracle/issues"
|
|
>GitHub</a> or on the <a
|
|
href="http://lists.sourceforge.net/lists/listinfo/cx-oracle-users"
|
|
>mailing list</a>.</p>
|
|
|
|
</div> <!-- /help -->
|
|
|
|
<div id="features">
|
|
|
|
<h2>Features</h2>
|
|
|
|
<ul>
|
|
<li><p>Easily installed from PyPI.</p></li>
|
|
|
|
<li><p>Support for Python 2 and 3.</p></li>
|
|
|
|
<li><p>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.</p></li>
|
|
|
|
<li><p>Connect to Oracle Database 9.2, 10, 11 or 12 (depending on the
|
|
Oracle Client version used).</p></li>
|
|
|
|
<li><p>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.</p></li>
|
|
|
|
<li><p>Full use of Oracle Network Service infrastructure, including
|
|
encrypted network traffic and security features.</p></li>
|
|
|
|
<li><p>Extensive Oracle data type support, including large object
|
|
support (CLOB and BLOB).</p></li>
|
|
|
|
<li><p>Direct binding to SQL objects. One great use case is binding
|
|
Python objects to Oracle Spatial SDO objects.</p></li>
|
|
|
|
<li><p>Array operations for efficient INSERT and UPDATEs.</p></li>
|
|
|
|
<li><p>Array row counts and batch error handling for array operations.</p></li>
|
|
|
|
<li><p>Fetching of large result sets.</p></li>
|
|
|
|
<li><p>REF CURSOR support.</p></li>
|
|
|
|
<li><p>Support for scrollable cursors. Go back and forth through your
|
|
query results.</p></li>
|
|
|
|
<li><p>Fetch PL/SQL Implicit Results. Easily return query results from
|
|
PL/SQL.</p></li>
|
|
|
|
<li><p>Row Prefetching. Efficient use of the network.</p></li>
|
|
|
|
<li><p>Client Result Caching. Improve performance of frequently
|
|
executed look-up statements.</p></li>
|
|
|
|
<li><p>Support for Advanced Queuing. Use database notifications to
|
|
build micro-service applications.</p></li>
|
|
|
|
<li><p>Continuous Query Notification. Get notified when data
|
|
changes.</p></li>
|
|
|
|
<li><p>Support for Edition Based Redefinition. Easily switch
|
|
applications to use updated PL/SQL logic.</p></li>
|
|
|
|
<li><p>Support for setting application context during the creation of
|
|
a connection, making application metadata more accessible to the
|
|
database, including in LOGON triggers.</p></li>
|
|
|
|
<li><p>End-to-end monitoring and tracing.</p></li>
|
|
|
|
<li><p>Transaction Management.</p></li>
|
|
|
|
<li><p>Session Pooling.</p></li>
|
|
|
|
<li><p>Database Resident Connection Pooling (DRCP).</p></li>
|
|
|
|
<li><p>Privileged Connections.</p></li>
|
|
|
|
<li><p>External Authentication.</p></li>
|
|
|
|
<li><p>Database startup and shutdown.</p></li>
|
|
|
|
<li><p>Sharded Databases</p></li>
|
|
|
|
<li><p>Oracle Database High Availability Features, such as FAN
|
|
notifications and Transaction Guard support.</p></li>
|
|
|
|
</ul>
|
|
|
|
<p>DB API specification exclusions: The time data type is not
|
|
supported by Oracle and is therefore not implemented. The method
|
|
<code>cursor.nextset()</code> 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
|
|
<a href="http://cx-oracle.readthedocs.io/en/latest/cursor.html#Cursor.getimplicitresults">cursor.getimplicitresults()</a>
|
|
for more information.
|
|
</p>
|
|
|
|
</div> <!-- /features -->
|
|
|
|
</div> <!-- /content -->
|
|
</div> <!-- /container -->
|
|
</body>
|
|
</html>
|
|
|