一、首先須要安裝好oracle數據庫,本機適用plsql鏈接數據庫正常,記錄下數據庫名稱python
二、安裝cx_oracle模塊sql
pip install cx_Oracle數據庫
三、python中引入模塊oracle
import cx_Oracle as cx測試
四、測試fetch
conn = cx.connect('sys/password@localhost/orcl')
cursor = conn.cursor ()
cursor.execute ("select * from dual")
row = cursor.fetchone ()
print (row)
cursor.close ()
conn.close () blog