I'm trying to use cx_Oracle
module in python to access a remote database and insert or delete rows in tables. BTW I have downloaded oracle instant client 11.1 and also odbc and sqlplus versions. I have set environment variables ORACLE_HOME
and TNS_ADMIN
to directory I have unzipped files there and add this this directory to the PATH
variable. As I googled I think there should be some .ora
files but I can't find them.
I can use sqlplus
commands from command line, but my main problem is that I can't install and use cx_Oracle
. I don't want to use any command line scripts; I just want to use cx_Oracle
as an API.
Can anyone give me a complete explanation, I'm really stuck there. All the documents in this area are vague. Best Regards.
EDIT 1:
I tried the source package of cx_Oracle
with python setup.py install
and python setup.py build --compiler=mingw32
commands. I don't get the oracle error again, but I'm getting command 'gcc' failed
error. I tried MinGW compiler and have edited environment variable PATH
to contain MinGW install directory(e.g. C:\MinGW
); I have also installed Microsoft Visual C++(versions 2005, 2008 and 2010); but I still get the error.
EDIT 2:
Since @jpmc26 mentioned about tnsnames.ora
files, I decided to add that I have tried to make a tnsnames.ora
and also a sqlplus.ora
file and put them in directory C:\oracle\instant_client_11_1\network\admin
; but as I googled I realized that if you use cx_Oracle.connect(username, password, cx_Oracle.makedsn(ip, port, sid))
command, you can skip .ora
files. cx_Oracle.makedsn
would make the structure itself.