cx_Oracle,要找匹配py版本和oracle版本的版本python
好比 cx_Oracle_py3.4_oracle12c_64位版本oracle
或者 cx_Oracle_py3.5_oracle11g_32位code
cx_Oracle-5.2.1+oci12c-cp34-none-win_amd64.whlip
cx_Oracle-5.2.1+oci12c-cp35-none-win32.whlci
下載地址: http://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_oracle字符串
連接字符串:connstr = """(DESCRIPTION =(ADDRESS_LIST =(ADDRESS =(PROTOCOL =TCP)(HOST =ip地址)(PORT =1521))) (CONNECT_DATA =(SID =MYSID)))"""class
conn_str = '''(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCL)))''' db=cx_Oracle.connect('system', '123456', conn_str)
若是有這個連接字符串就無需環境變量了。不然要用環境變量TNS_ADMIN指出TNSNAME.ORA文件的位置;變量
若是涉及中文最好加入 語言那個環境變量,能夠用程序寫入。下載
NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK程序
--------
11g須要3個文件
oci.dll
oraociei12.dll
oraocci11.dll
12c須要3個文件
oci.dll
oraociei12.dll
oraons.dll
補充:須要系統dll支持,須要VC++2005 Runtime(在win2003中就必須裝這個)