# python连接oracle数据
## 介绍
-----------------------------
- python 连接oracle数据库,可以使用cx_oracle模块
- 使用如下命令安装
```
python -m pip install cx_oracle --pre
```
## 连接oracle代码
-----------------------------
```python
import cx_oracle
# 设置
dsn = cx_oracle.makedsn("192.168.0.233", 1521, "tongji")
# 连接
conn = cx_oracle.connect("sas","tongji123",dsn)
curs = conn.cursor()
sql = 'select * from case_info where rownum<10'
rr = curs.execute (sql)
row = curs.fetchone()
print row[0]
# 关闭
curs.close()
conn.close()
```