You all are fired. That matter aside, I need help deciphering an error code I am seeing when trying to use the cx_Oracle module to connect to an Oracle database. For some irresponsible and moronic reason I am using Python2.7 instead of Python3000. The error message I see is as follows (copy/pasted of course):
>>> connection = cx_Oracle.connect('user', 'password123', 'db1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cx_Oracle.DatabaseError: DPI-1050: Oracle Client library is at version 11.2 but
must be at version 0.0 or higher
>>>
I found some terrible documentation inside the module itself via this command: help('cx_Oracle.connect')
This command yields the following page, first page only shown for conciseness:
Help on class Connection in cx_Oracle:
cx_Oracle.connect = class Connection(__builtin__.object)
| Methods defined here:
|
| __enter__(...)
|
| __exit__(...)
|
| __init__(...)
| x.__init__(...) initializes x; see help(type(x)) for signature
|
| __repr__(...)
| x.__repr__() <==> repr(x)
|
| begin(...)
|
| cancel(...)
|
| changepassword(...)
|
| close(...)
|
| commit(...)
|
| createlob(...)
|
| cursor(...)
|
| deq(...)
|
| deqoptions(...)
|
| enq(...)
|
| enqoptions(...)
|
| getSodaDatabase(...)
|
| gettype(...)
|
| msgproperties(...)
|
| ping(...)
|
| prepare(...)
-- More --
I found a better explanation on how to use the API at the following web page: https://dzone.com/articles/python-code-can-connect-oracle
One wonders why the module authors did not write clear instructions as the author of the web page did such as:
# Connect using the ordered parameters user, password and SID.
dbconn = cx_Oracle.connect('user', 'password' ,'SID')
I also found some more documentation at the following URL: https://developer.oracle.com/databases/database-for-python-developers-1
This documentation maybe from another era and for an earlier implementation of the Oracle database.
From what I gather this plug-in is only for 11g Oracle databases and maybe lower. The pluggable database(s) I am using and the normal databases, lack of a better term, are all 12c. Is this plug-in only for version <=11 of the Oracle database?
The copy/paste below shows a banner from one of the databases.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing op
ions
Respectfully,
A dumb guy
----------------------UPDATE----------------------------------------------------
I took the helpful dev on this software project's advice and now I receive a new error. I deleted some things I do not think I need from my path regarding version 11 of the Oracle DB and see a new error message:
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (
Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> connection = cx_Oracle.connect('user', 'password', 'oracledb')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cx_Oracle.DatabaseError: DPI-1047: 32-bit Oracle Client library cannot be loaded
: "C:appclientcorpDroneproduct12.1.0client_1inoci.dll is not the correct a
rchitecture". See https://oracle.github.io/odpi/doc/installation.html#windows fo
r help
I figured it out. I followed the link in the error message above and then downloaded the 32 bit instant client lite software and put this as the first thing in my path. Then I followed the manual and put the tnsnames.ora file on my path second referenced from the TNS_NAMES environment variable. :) Hope this helps some sorry jerk later. :D
An even simpler option is to re-install your implementation of Python. In my case I need 64bit Python to communicate with the 64bit Oracle DBMS software.
See Question&Answers more detail:
os