python 连接Oracle 的步骤
时间:2021-07-01 10:21:17
帮助过:18人阅读
coding:utf-8
import pandas as pd
import sys
import codecs
#sys.stdout = codecs.getwriter("gbk")(sys.stdout.detach())
from sqlalchemy
import create_engine
import cx_Oracle
#db=cx_Oracle.connect(‘admin‘,‘admin‘,‘172.16.1.452:1521/orcl‘,encoding = "UTF-8", nencoding = "UTF-8")
db=cx_Oracle.connect(
‘你的账号‘,
‘密码‘,
‘IP:端口/服务名‘,encoding =
"UTF-8", nencoding =
"UTF-8")
print (db.version)
cr=
db.cursor()
SQL2 =
‘‘‘SELECT * FROM OA_W_BAOXIAOMXYWB‘‘‘
cr.execute(SQL1)
rs=
cr.fetchall()
zz=
pd.DataFrame(rs)
print (zz)
db.close()
python 连接Oracle 的步骤
标签:dataframe port import ora 安装 连接 write oracl 百度搜