python遠端連線Oracle資料庫環境配置步驟

2021-06-21 02:56:06 字數 1121 閱讀 5856

python遠端連線oracle資料庫總結

1. python 連線資料庫**:

def oracledbconnect(self):

try:    

conn = cx_oracle.connect("mdm","netqin123","192.168.33.160:1521/dex")    

cursor = conn.cursor()  

cursor.execute("""select * from t_user""")  

one = cursor.fetchall()

for row in one:  

print row

cursor.close()

conn.commit();        

conn.close()

except cx_oracle.error,e:

print "oracle error %d: %s" % (e.args[0], e.args[1])

2. 安裝cx_oracle 外掛程式:

參考安裝「cx_oracle-5.1.2-11g.win32-py2.7.msi」

3. 安裝oracle資料庫客戶端:

直接安裝win32_11gr2_client.zip

4. 將instantclient檔案安裝:

將instantclient_11_2.zip解壓後,放入安裝好的oracle資料庫product目錄下

5. copy檔案到python安裝目錄下

將instantclient_11_2檔案下oci.dll, oraocci11.dll,oraociei11.dllcopy到python安裝目錄下lib/site-packages下

6. 配置環境變數:

設定instantclient環境變數,新增instantclient路徑到path路徑下

經過以上步驟,python能成功連線oracle資料庫

PowerDesigner連線Oracle資料庫

引用 一。注意 1.powerdesigner的安裝目錄不能有空格,否則測試連線時報錯uable to connect,sqlstate 08004,ora 12154 tns 無法解析指定的連線識別符號 二。建立連線,win7系統,64位,oracle伺服器在遠端11g,本地僅安裝32位10g的o...

PLSQL連線遠端資料庫 不安裝Oracle

orclname description address list address protocol tcp host 192.168.1.1 port 1521 connect data service name orcl orclname自己看如何使用方便,自己更換 host配自己需要的ip p...

python 遠端連線oracle mysql

遠端連線oracle出現的問題 oracle客戶端的版本,cx oracle的版本,要與python版本和位數對應 我的python版本 python3.5 64位 cx oracle的版本 cx oracle 7.0.0 cp35 cp35m win amd64.whl oracle客戶端的版本 ...