1、首先需要安装好oracle数据库,本机适用plsql连接数据库正常,记录下数据库名称

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

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 () 

相关文章:

  • 2021-12-17
  • 2022-03-09
  • 2021-09-15
  • 2021-06-13
  • 2022-01-17
  • 2021-08-20
  • 2021-12-03
猜你喜欢
  • 2021-12-02
  • 2022-12-23
  • 2021-04-26
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2021-06-05
相关资源
相似解决方案