cx_Oracle 6.0

Anthony Tuininga anthony.tuininga at
Mon Aug 14 18:33:03 EDT 2017

What is cx_Oracle?

cx_Oracle is a Python extension module that enables access to Oracle
Database for Python 3.x and 2.x and conforms to the Python database API 2.0
specifications with a number of enhancements.

Where do I get it?

The easiest method to install cx_Oracle 6.0 is via pip as in

    python -m pip install cx_Oracle --upgrade

What's new since 5.3?

This is the first production release of version 6.0. The complete release
notes can be found here: http://cx-oracle.readthe

A summary of the changes compared to version 5.3 is found below:

*Highlighted Enhancements*

- Has been re-implemented to use the new ODPI-C ( abstraction layer for Oracle Database. The
cx_Oracle API is unchanged. The cx_Oracle design, build and linking process
has improved because of ODPI-C.

- Now has Python Wheels available for install. This is made possible by the
ODPI-C architecture. Windows installers and Linux RPMs are no longer
produced since PyPI no longer supports them.

- Has less code in Python's Global Interpreter Lock, giving better

- Added support for universal rowids.

- Added support for DML returning of multiple rows.

- Now associates LOB locators to LOB objects so they are not overwritten on
database round trips.

*Installation Changes*

- On Linux, cx_Oracle 6 no longer uses instant client RPMs automatically.
You must set LD_LIBRARY_PATH or use ldconfig to locate the Oracle Client

- On platforms other than Windows, if ORACLE_HOME is set (in a database or
full client installation), remove requirement to set LD_LIBRARY_PATH in
order to locate the Oracle Client library (

*Connection Management Enhancements*

- Prevent closing the connection when there are any open statements or LOBs
and add new error "DPI-1054: connection cannot be closed when open
statements or LOBs exist" when this situation is detected; this is needed
to prevent crashes under certain conditions when statements or LOBs are
being acted upon while at the same time (in another thread) a connection is
being closed; it also prevents leaks of statements and LOBs when a
connection is returned to a session pool.

- Added attribute SessionPool.stmtcachesize to support getting and setting
the default statement cache size for connections in the pool.

- Added attribute Connection.dbop to support setting the database operation
that is to be monitored.

- Added attribute Connection.handle to facilitate testing the creation of a
connection using a OCI service context handle.

- Added parameters tag and matchanytag to the cx_Oracle.connect and
SessionPool.acquire methods and added parameters tag and retag to the
SessionPool.release method in order to support session tagging.

- Added parameter edition to the cx_Oracle.SessionPool method.

- Added parameters region, sharding_key and super_sharding_key to the
cx_Oracle.makedsn() method to support connecting to a sharded database (new
in Oracle Database 12.2).

- Removed requirement that encoding and nencoding both be specified when
creating a connection or session pool. The missing value is set to its
default value if one of the values is set and the other is not (

 - Permit use of both string and unicode for Python 2.7 for creating
session pools and for changing passwords (

*Data Type and Data Handling Enhancements*

- Added attributes Variable.actualElements and Variable.values to

- Added support for smallint and float data types in Oracle objects, as
requested (

- Added support for getting/setting attributes of objects or element values
in collections that contain LOBs, BINARY_FLOAT values, BINARY_DOUBLE values
and NCHAR and NVARCHAR2 values. The error message for any types that are
not supported has been improved as well.

- An exception is no longer raised when a collection is empty for methods
Object.first() and Object.last(). Instead, the value None is returned to be
consistent with the methods and Object.prev().

- Removed requirement for specifying a maximum size when fetching LONG or
LONG raw columns. This also allows CLOB, NCLOB, BLOB and BFILE columns to
be fetched as strings or bytes without needing to specify a maximum size.
The method Cursor.setoutputsize no longer does anything, since ODPI-C
automatically manages buffer sizes of LONG and LONG RAW columns.

- Enable temporary LOB caching in order to avoid disk I/O as suggested (

*Error Handling Enhancements*

- Provide improved error message when OCI environment cannot be created,
such as when the oraaccess.xml file cannot be processed properly.

- Define exception classes on the connection object in addition to at
module scope in order to simplify error handling in multi-connection
environments, as specified in the Python DB API.

*Test Enhancements*

- Reworked test suite and samples so that they are independent of each
other and so that the SQL scripts used to create/drop schemas are easily
adjusted to use different schema names, if desired.

 - Updated DB API test suite stub to support Python 3.


- Dropped deprecated parameter twophase from the cx_Oracle.connect method.
Applications should set the Connection.internal_name and
Connection.external_name attributes instead to a value appropriate to the

- Dropped deprecated parameters action, module and clientinfo from the
cx_Oracle.connect method. The appcontext parameter should be used instead.

- Dropped deprecated attribute numbersAsString from cursor objects. Use an
output type handler instead.

- Dropped deprecated attributes cqqos and rowids from subscription objects.
Use the qos attribute instead.

- Dropped deprecated parameters cqqos and rowids from the
Connection.subscribe() method. Use the qos parameter instead.

More information about the Python-announce-list mailing list