简体   繁体   中英

How can I connect Oracle datasource in Python in Remote Machine?

I am trying to connect Oracle datasource using Python in my remote machine. My python version and cx_Oracle details as follows, 在此处输入图像描述

here is my code to connect Oracle,

import cx_Oracle

dsn_tns = cx_Oracle.makedsn('host_name', 'port', service_name='service_name') 
conn = cx_Oracle.connect(user='user', password='pws', dsn=dsn_tns) 
c = conn.cursor()
c.execute('select * from DB.TABLE')

for row in c:
   print(row[0])

conn.close()

Even python and Oracle are 32 bits, I am getting 32 bit Oracle client library issues.

Exception has occurred: DatabaseError
DPI-1047: Cannot locate a 32-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help

Can anyone please help me to resolve this issue?

Not really sure how to manage this in remote machine. If you suggest the commands to run on terminals it would be easy for me to deal in remote machine.

The issue fixed. I downloaded 32 bit Oracle Instant client files(zip) from the link https://www.oracle.com/in/database/technologies/instant-client/microsoft-windows-32-downloads.html (Basic package) and set the PATH in environment variables solved my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM