> 文章列表 > python 连接oracle

python 连接oracle

python 连接oracle

前提,navicate成功连接oracle

1、下载cx_oracle,根据python版本下载whl,或者通过

​pip install cx_Oracle -i http://pypi.douban.com/simple/

下载地址: cx-Oracle · PyPIicon-default.png?t=N2N8https://pypi.org/project/cx-Oracle/#files2、navicate下instantclient_21_7文件夹中的oci.dll、oraocci11、oraociei11的3个DLL粘贴到PY目录的Libs/site-packages文件夹下面。

instantclient_21_7下载地址:Instant Client for Microsoft Windows (x64) 64-bithttps://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html3、import cx_Oracle

4、连接数据库

conn = cx_Oracle.connect('用户名','密码','IP地址:端口号/ORCL')
cursor = conn.cursor()
select = cursor.execute(sql)