Python操作Oracle數據庫

參考:Python實戰之Oracle數據庫操作

安裝報無權限,加user參數:pip install cx-Oracle --user

報錯1:cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1): image not found". See https://oracle.github.io/odpi/doc/installation.html#macos for he

解決:按提示進入官網https://oracle.github.io/odpi/doc/installation.html#macos

 

def query():
    conn = cx_Oracle.connect(db_connect_link)
    cursor = conn.cursor()
    cursor.execute("SELECT ID, TOKEN FROM ******")
    row = cursor.fetchone()
    cursor.close()
    conn.close()
    return row[0], row[1]

db_connect_link:user_name/password@ip:port/server_name

發佈了36 篇原創文章 · 獲贊 10 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章