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万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章