python链接oracle数据库
import pandas as pd
import numpy as np
import janitor
import oracledb
#链接方式一
params = oracledb.ConnectParams(host="192.168.30.48", port=1521, service_name="JZDB1")
con = oracledb.connect(user="ipvsdb", password="######",params=params)
#链接方式二
dsn=f'{"ipvsdb"}/{"#####"}@{1521}:192.168.30.48/JZDB1'
con=oracledb.connect(dsn)
sqldq = ''' select dzbm,dzmc from sys_xzqh_zzjg '''
xzqh = pd.read_sql(sqldq, con)
con.close()
评论
发表评论