import os
import cx_Oracle
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
db_orcl = cx_Oracle.connect("用户/sid@ip/orcl")
cr_orcl = db_orcl.cursor()
cr_orcl.execute("select * from user ")
rs_user = cr_orcl.fetchall()
for user in rs_user:
userId = user[0]
print(userId)
if user[1] == '':
continue
blob = user[1].read()
f = open("D:\\allImages\\"+userId+".jpg", "wb")
f.write(blob)
f.close()
db_orcl.commit()
cr_orcl.close()
python 读取数据库中的BLOB类型字段,并存储文件到本地
最新推荐文章于 2024-09-15 12:26:00 发布