Install cx_Oracle on Windows

About cxOracle. CxOracle 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. CxOracle 8.2 has been tested with Python versions 3.6 through 3.9.

These installation instructions assume that you are on 64-bit Windows and have a Windows x64 Oracle 11gR2 database running on your machine. The Oracle database can be on any edition of Oracle (Express, Standard, Enterprise). If you are running a Windows x32 version of the Oracle database, but your machine is on 64-bits, you should first install Windows x64 of Oracle before proceeding with this tutorial.
Note that Oracle Express 11gR2 for Windows x64 can be downloaded from http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html

I am trying to do a simple select all query in python using the Cxoracle module. When I do a select all for the first ten rows in a table I am able to print our the output. However when I do a select all for the first ten rows for a specific date in the table all that gets printed out is a blank list like this:. CxOracle 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. See the homepage for a feature list. CxOracle 8.2 has been tested with Python versions 3.6 through 3.9.

Step 1-download and install Python for 64-bit Windows
-go to URL: https://www.python.org/downloads/windows/
-scoll down the list until you see Python 2.7.1 - 2010-11-27
-download Windows x86-64 MSI installer (filename: python-2.7.1.amd64.msi)
-go through the installer by accepting all the defaults. The install directory will be C:Python
-once the installation is complete, add the following locations to the windows PATH variable: C:Python and C:PythonLibsite-packages
-open a command window and launch the python interpreter by running 'python' on the command-line prompt
you should get:
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)] on win32
Type 'help', 'copyright', 'credits' or 'license' for more information.
>>>

Step 2-download and install the Oracle driver for Python called cx_Oracle
-go to URL: https://pypi.python.org/pypi/cx_Oracle/5.1.3
-select and download cx_Oracle-5.1.3-11g.win-amd64-py2.7.exe (md5) (filename: cx_Oracle-5.1.3-11g.win-amd64-py2.7.exe)
-run through the cx_Oracle installer by accepting all the defaults. The installer should detect the existing Python installation under C:Python
-open a new command window and bring up the python interpreter as before by running 'python'
-run: import cx_Oracle
you should get:

C:Usersshir7084>python
Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32
Type 'help', 'copyright', 'credits' or 'license' for more information.
>>>
>>> import cx_Oracle
>>> con = cx_Oracle.connect('ap/ap@127.0.0.1/xe')
>>> print con.version
11.2.0.2
>>> con.close()

Note: if you get the output 11.2.0.2 or 11.2.0.3 or 11.2.0.4 from the above test, then you are good. If you get an error, please post the entire output on Piazza including the error.

cx_Oracle is a module that enables access to Oracle Database and conformsto the Python database API specification. This module is currently testedagainst Oracle Client 21c, 19c, 18c, 12c, and 11.2, and Python 3.6, 3.7, 3.8and 3.9. Older versions of cx_Oracle may be used with previous Pythonreleases.

cx_Oracle is distributed under an open-source license(the BSD license). A detailed description of cx_Oracle changes can be found inthe release notes.

Contents:

Cx Oracle Python

Cx_oracle Python Insert Example

  • Introduction to cx_Oracle
  • cx_Oracle 8 Installation
    • Installing cx_Oracle on Linux
    • Installing cx_Oracle on Windows
    • Installing cx_Oracle on macOS (Intel x86)
  • cx_Oracle 8 Initialization
    • Locating the Oracle Client Libraries
  • Connecting to Oracle Database
    • Connection Strings
    • Connection Pooling
    • Connecting Using External Authentication
    • Connecting to Oracle Cloud Autononmous Databases
  • SQL Execution
    • SQL Queries
    • INSERT and UPDATE Statements
  • PL/SQL Execution
  • Using Bind Variables
  • Using CLOB and BLOB Data
  • Working with the JSON Data Type
  • Simple Oracle Document Access (SODA)
  • Batch Statement Execution and Bulk Loading
  • Oracle Advanced Queuing (AQ)
  • Continuous Query Notification (CQN)
  • Transaction Management
  • Tuning cx_Oracle
    • Tuning Fetch Performance
    • Database Round-trips
  • Character Sets and Globalization
    • Setting the Client Character Set
  • Starting and Stopping Oracle Database
  • High Availability with cx_Oracle
  • Tracing SQL and PL/SQL Statements

Cx_oracle Python Documentation

  • Module Interface
    • Constants
  • Subscription Object
  • Object Type Objects
  • Advanced Queuing (AQ)
  • SODA