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