MFTS
MFTS

Reputation: 35

DPI-1050: Oracle Client library is at version 0.0 but version 11.2 or higher is needed

I'm trying to connect to my work's remote DB but when I run the python script it shows this error.

I already did everything this guide says I should have as requirements but the error keeps showing. I've tried to connect through sql* and it works as it should. I downloaded oracle client libraries 12.2 (32 bits version since it needs to have the same architecture as python), I'm working with Oracle Database 11g version 11.2.0.3, Python 3.7 and I already installed Visual Studio Redistributable 2013.

This is the python script I'm using to connect to the DB. Obviously, the IP and port are different from the real one, as well as the credentials.

import cx_Oracle

host='196.0.0.0'
port='8080'
service_name='SID'
pwd= 'PASS'

dsn_tns = cx_Oracle.makedsn(host,port,service_name)

connection = cx_Oracle.connect('user',pwd,dsn_tns)

Whenever I run it, I get the error eventhough the oracle client libraries folder are already on the PATH of my computer. Do I have to configure something from the server side? Thanks for the help!

Upvotes: 0

Views: 12102

Answers (6)

Tarun Kandikupa
Tarun Kandikupa

Reputation: 11

You need to install same version of Python and database client. For Example: 64 bit python and 64 bit client or both 32 bit will work. I tired with Oracle XE 18c and python-3.8.3-amd64.exe

Upvotes: 1

Māris L
Māris L

Reputation: 37

I had same problem DPI-1050: Oracle Client library is at version 0.0 but version 11.2 or higher is needed on Windows 10 with PyCharm and Selenium

I found that application which is installed in my pc contains oic.dll file. I know that application is in very old technology and first tried with that. Renamed that file to other and problem was solved. Connection with DB was successful

Only problem in my case is that next time when I will start that application it need that file, so i need to change file name back to oic.dll.

Upvotes: 0

Vydra21
Vydra21

Reputation: 101

The problem might be related to this issue.
In short:
The Oracle Instant Client version 19.3.0.0.0 is not supported on Windows 7.
It is also mentioned in Operating System Checklist for Oracle Database Client Installation.

Upvotes: 0

Orchard
Orchard

Reputation: 21

In fact, it's a version problem. I found the same problem when i used version 19. I have solved this problem when i changed the version to 12.2

Upvotes: 2

OracleERP123
OracleERP123

Reputation: 48

I had the exact same issue and I referred to the document you linked here. I am using PyCharm as the IDE and using the python.exe which pycharm uses, I found it is 32 bit (just click the python.exe and the command prompt like screen opens and first line tells if it is 32bit or 64 bit).

Then using the below link, I downloaded the Oracle Instant Client.

https://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html

I chose the 32 bit and 12.2 version (latest was v18.x at the time of writing this). This 32bit has to match your python version (which was also 32 bit in my case).

Then I extracted the zip file of instant client, put it in C:\oracle folder (doesn't matter where you put) and the my directory structure was..

C:\oracle\instantclient_12_2

Now I put this location as first location in my "Path" system environment variable of Windows machine.

After doing all this, I restarted machine (not needed) and used pycharm and connected like this...

import cx_Oracle as cxo
conn = cxo.connect("user_id", "password", "host_name:port_no/sid")
print(conn.version)
cur = conn.cursor()
cur.execute('SELECT \'X\' FROM DUAL')
for result in cur:
    print(result[0])
cur.close()
conn.close()

Upvotes: 1

Anthony Tuininga
Anthony Tuininga

Reputation: 7086

The error message has been improved in cx_Oracle 7.1 -- but the problem is that an older version (than 11.2) of the Oracle Client libraries has been detected. You need to make sure that the newer version you've installed is being detected. You can do that by ensuring that your PATH environment variable contains your 12.2 client libraries first. In the past, older versions of the Oracle Client libraries were often installed into C:\windows\system32.

Upvotes: 0

Related Questions