cx_Oracle installation issue


I have a Windows 10 64 bit OS.

I was running Python 2.7. I installed cx_Oracle previously, which worked fine. I had to reinstall my operating system, etc recently and have been re-installing software.

I have Oracle 11g Express Edition installed and running - presume it is 64 bit??

I have installed cx_Oracle, instant client 32 + 64 bit versions. Neither works, I get an error message regardless of which version I use.


The installation software says to point to environment path to oci.dll.

InstantClient 32 bit doesn't have it only: sqora32.dll, sqresja.dll and sqresus.dll


I want to upgrade to Python 3.6 64 bit, does this install and run cx_Oracle easier???






Comment actions Permalink

Hi Clive,

What error exactly do you have when running PyCharm? Please note that for any JDK compatibility related issues we recommend explicitly selecting PyCharm to use the bundled JDK. You can do this by creating a `PYCHARM_JDK_64` environment variable and pointing it to `jre64` directory inside your PyCharm installation path.

Let us know if this doesn't help or if your issue is not related to JDK.

Comment actions Permalink

Hi Andrey,

I have installed Pycharm 2018.3.4 withOracle 11g XE +  instant client 64-bit. Using standard environment settings.

conn_str = 'SYSTEM/Orac2019@localhost:1521/XE'

I am now getting a 32-bit error??

cx_Oracle.DatabaseError: DPI-1047: 32-bit Oracle Client library cannot be loaded: "C:\oraclexe\app\oracle\product\11.2.0\server\bin\oci.dll is not the correct architecture"

Comment actions Permalink
Hi Clive Why do you install Oracle database with PyCharm? PyCharm doesn't require it, it only requires Java Virtual Machine (JVM) which is part of Oracle JDK or JRE. However, PyCharm comes with it's own bundled JRE and this is the one we recommend using. If you have any other JRE/JDK installed in your system, they may conflict with the bundled one, so that's why you should tell PyCharm that it should be using the bundled JRE. Since you have 64-bit Windows, the bundled JRE is located in `/jre64` folder The easiest way to tell PyCharm to use that JRE, is to create an environment variable `PYCHARM_JDK_64` and the value of that variable should be the path to `/jre64` (substitute with the real path to your installation folder) Let me know if you have any other questions.
Comment actions Permalink

Hi Jiri,

I installed Oracle database XE, which works. I updated the environment variable `PYCHARM_JDK_64'


I am still having issues connecting Pycharm to Oracle. I have tried jdbc:thin, cx_Oracle, pyodbc 

Having issues with all drivers to connect to Oracle??


I can connect to Oracle with SQL Server + PyCharm, which shows the connection in Pycharm Database window.

I copied the Pycharm jdbc sql statement and get no driver error??


import os
import sys
import time
import datetime

import csv
import cx_Oracle
import pyodbc
import jaydebeapi

import inm_rinmfp_parms

#Enter the values for you database connection
dsn_database2 = "XE"
dsn_hostname2 = "DESKTOP_DJK5SEF"
dsn_port2 = "1521"
dsn_uid2 = "SYSTEM"
dsn_pwd2 = "Orac2019"

jdbc-driver = "oracle.jdbc.OracleDriver"

conn = DriverManager.getConnection(jdbc-url, "SYSTEM""Orac2019"       )

curs = conn.cursor()
vsql = "select * FROM BATCH"


No file found???

exec(compile(contents+"\n", file, 'exec'), glob, loc)

File "C:/Users/User/PycharmProjects/INM_Import_Data/", line 22

jdbc-driver = "oracle.jdbc.OracleDriver"


SyntaxError: can't assign to operator




File "C:/Users/User/PycharmProjects/INM_Import_Data/", line 27, in <module>

connection = cx_Oracle.connect(v_db_connection)

cx_Oracle.DatabaseError: DPI-1047: 32-bit Oracle Client library cannot be loaded: "C:\oraclexe\app\oracle\product\11.2.0\server\bin\oci.dll is not the correct architecture"

I had InstantClient 34-bit installed and got Architecture error.

I uninstalled InstantClient 34-bit and have installed InstantClient 64-bit .




   exec(compile(contents+"\n", file, 'exec'), glob, loc)

  File "C:/Users/User/PycharmProjects/INM_Import_Data/", line 24

    Driver={Microsoft ODBC for Oracle};


SyntaxError: invalid syntax




Comment actions Permalink

Hi Clive,

So your issue is about connecting to the database, not with running PyCharm (as I initially thought).

Have you tried to add this database connection as a new datasource? Please see screenshot

The following dialog should offer you to download the drivers.


Please sign in to leave a comment.