首页 > 解决方案 > 如何在 Python 中从 Informix 和 Oracle 数据库中检索图像?

问题描述

我正在编写一个 python 脚本来从 Informix/Oracle 数据库获取图像数据(blob)并将图像上传到 AWS S3。我的部分代码如下:

try:
    cur = conn.cursor()
    cur.execute(sql)

    for row in cur:
        client = trim(row[0])
        date = trim(row[1])
        filename = trim(row[2])
        imageblob = row[3].read()
        write_file(filename, imageblob)

我收到以下错误(Informix 案例):

Error: <class '_informixdb.InterfaceError'>
Traceback (most recent call last):
  File "UploadImagesToS3.py", line 57, in getImageFromDB
    imageblob = row[3].read()
InterfaceError: Sblob is not open

有人可以帮忙吗?代码需要与 Informix 和 Oracle DB 兼容。谢谢

标签: pythonoracleblobinformix

解决方案


推荐阅读