0

I am trying to run oracle database in python. Specifications: 1. Windows 7 64 bit 2. Python 32 bit 3.6 (Running on Jupyter(Anaconda Navigator) 3.Visual studio 2010 training kit module 4.Oracle instant client basic 12.2 32 bit 5.Oracle instant client basic SQL*Plus 12.2 32 bit

I have installed cx_Oracle via command import sys !conda install --yes --prefix {sys.prefix} cx_Oracle import cx_Oracle

After that I have installed Oracle instant client basic 12.2 32 bit and Oracle instant client basic SQLPlus 12.2 32 bit in the same working directory from where Jupyter is connected. I have copied both installed Oracle instant client basic and instant client basic SQLPlus in same folder and have given environment path of the same folder. But whenever I am running the command it's giving error: DPI-1047: 64-bit Oracle Client library cannot be loaded: "C:\oracle\product\10.2.0\client_1\bin\oci.dll is not the correct architecture". See https://oracle.github.io/odpi/doc/installation.html#windows for help Although there is nothing of 64 bit except windows which I have search doesn't matter.

Kshitiz Tiwari
  • 11
  • 1
  • 1
  • 4
  • Did you compile to "AnyCPU"? – Wernfried Domscheit Jul 30 '18 at 17:27
  • Sorry but can you please elaborate a little bit more as I am new to it and still trying to understand things. Thanks in advance. – Kshitiz Tiwari Jul 31 '18 at 04:30
  • For future readers: use the latest version of cx_Oracle, which got renamed to python-oracledb. This doesn't need Oracle Client libraries by default, so you won't get DPI-1047. See the [release announcement](https://levelup.gitconnected.com/open-source-python-thin-driver-for-oracle-database-e82aac7ecf5a). – Christopher Jones Jul 26 '22 at 04:59

1 Answers1

0

You need to install 64-bit Instant Client not 32-bit - the error is clear about this. When you run Python make sure Instant Client is in your PATH environment variable before the Oracle 10.2 directory, or any other Oracle libraries.

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48
  • Even if the python is installed is 32 bit? I have researched and found that instant client should be of same bit as that of interpreter. Can you please help me with the concept behind it. – Kshitiz Tiwari Aug 01 '18 at 08:42
  • Now My Anaconda is 64 bit, instant client is 64 bit 12_1, Windows is 64 bit and I have set the path for OCI.dll in environmental variable after the instant client path but I am still getting the same error. – Kshitiz Tiwari Aug 01 '18 at 15:28
  • If the error still mentions C:\oracle\product\10.2.0\client_1\bin\oci.dll then you haven't set PATH correctly. And don't forget to install the VC 2010 Redistributable if you installed Instant Client 12.1. Show us the actual value of PATH if you still have problems. – Christopher Jones Aug 02 '18 at 01:45
  • The path that I am giving is same what error is throwing and is the correct path to reach OCI.dll. Path is "C:\oracle\product\10.2.0\client_1\bin\oci.dll". – Kshitiz Tiwari Aug 02 '18 at 15:26
  • From the [installation instructions](http://cx-oracle.readthedocs.io/en/latest/installation.html#id3), cx_Oracle only works with 11.2 or later Oracle client DLLs. And why install Instant Client 12.2 if you don't put it first in PATH?? Please read and follow the installation instructions. – Christopher Jones Aug 02 '18 at 21:55
  • Hi, there is some confusion and that too is from my side I believe. This was not the complete path I provided. I have first given path of Instant client and then this path after the comma in environmental variable. Full path is: "C:\Users\Kshitiz\instantclient_12_2, C:\oracle\product\10.2.0\client_1\bin\oci.dll." I may be doing some very silly mistake but not able to pin point it. – Kshitiz Tiwari Aug 03 '18 at 12:42
  • On Windows, the separator in PATH is a semi-colon ';'. What you have typed in your comment above is a comma ','. Note that you probably need to change PATH each time you run different products, so that the correct version libraries are used by each one. – Christopher Jones Aug 03 '18 at 23:21
  • could you explain what path mean, and where shall I set up the path – xappppp Mar 04 '19 at 21:54
  • Check the cx_Oracle installation instructions: see the link in a previous comment. – Christopher Jones Mar 05 '19 at 02:58