-1

unable to run oracle database using python

Traceback (most recent call last):   File "Oracle.py", line 2, in <module>     
con=cx_Oracle.connect('scott/tiger@localhost') 
cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 32-bit Oracle Client 
library: "C:\Users\Mahesh\Music\bin\oci.dll is not the correct architecture". 
See https://oracle.githu
Badger
  • 1,043
  • 10
  • 25
  • Please add additional context to the body of your question, describe what you were doing to achieve this error, include some code to give us an idea of how you got here, and describe the routes you've attempted to solve this issue. – Badger Feb 24 '20 at 17:09
  • 2 things: Did you install oracle client? Did you adjust your env to have python see where the DLLs are stored? – gsalem Feb 24 '20 at 21:32

1 Answers1

0

It seems you have 32-bit Python but are trying to use a 64-bit set of Oracle libraries. This won't work.

Option 1: install 64-bit Python and reinstall cx_Oracle.

Option 2: install a 32-bit Oracle Instant Client, and add its directory to the start of PATH before you run Python. You may need to be careful not to break other apps that need the 64-bit Oracle client libraries.

PS. your connect string will need to give a service name after "localhost", see the cx_Oracle Connection Strings documentation.

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48