N
N
Nikolay Baranenko2017-03-13 13:44:00
Oracle
Nikolay Baranenko, 2017-03-13 13:44:00

If there are other options to connect to Oracle other than cx_Oracle?

Hello.
at the moment I use the
cx_Oracle library to connect to oracle

#!/usr/bin/python
import cx_Oracle

ip = 'hostname'
port = 1522
SID = 'oraclesid'

dsn_tns = cx_Oracle.makedsn(ip, port, SID)
print (dsn_tns)
conn = cx_Oracle.connect('user', 'password', dsn_tns)
c = conn.cursor()
c.execute(sql_script)
for row in c:
    print (row[0], row[1])
conn.close()

but it's time to move the python script from the development machine, just to a windows server with the python 3.5 interpreter installed.
He didn't want to work
Traceback (most recent call last):
  File "oracle.py", line 2, in <module>
    import cx_Oracle
ImportError: DLL load failed: %1 is not a valid Win32 application.

At first, I thought that it was all about the correct installation of the cx_Oracle python module.
But as it turned out, if I understood everything correctly, it will not work if there is no OracleClient on the machine.
Such a "trailer" in the form of an additional installation of OracleClient is, to put it mildly, not very convenient...
Are there other methods/libraries for connecting to Oracle other than cx_Oracle, and which ones?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Draconian, 2017-03-13
@drno-reg

So there is nothing wrong with installing a client on a server. Once set and forgotten.
In principle, you can work with Oracle through ODBC and JDBC (as in SQL Developer, for example), in python this is the JayDeBiApi module. Try it, I haven't personally tried it.

E
Eugene, 2017-03-13
@Lorien_Elf

It is not necessary to install the full client, you can limit yourself to InstantClient.
www.oracle.com/technetwork/database/features/insta...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question