您的位置:首页 > 数据库 > Oracle

Python3.5在Windows 7下连接ORACLE数据库

2016-12-09 15:22 337 查看
1、首先需要安装好oracle数据库,本机适用plsql连接数据库正常,记录下数据库名称





2、安装cx_oracle模块

pip install cx_Oracle

3、python中引入模块

import cx_Oracle as cx

4、测试

conn = cx.connect('sys/password@localhost/orcl')
cursor = conn.cursor ()
cursor.execute ("select * from dual")
row = cursor.fetchone ()
print (row)
cursor.close ()
conn.close ()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: